: List(rhs) // calls copy ctor of List class You do this by calling the base class: Stack(const Stack& rhs)
However, you still need to ensure that any base classes are given the opportunity to initialize their members. Interface* my_foo = /* somehow construct either a Foo or a Bar */ ĮDIT: Since Stack has no member variables, there's nothing to do in the copy constructor or copy assignment operator to initialize Stack's members from the so-called 'right hand side' ( rhs). How can I turn a List of Lists into a List in Java 8?įlatmap is better but there are other ways to achieve the same listStream.reduce(new ArrayList(), (l1, l2) ->