copy C'tor with operator= | C++
Posted
by
user2266935
on Stack Overflow
See other posts from Stack Overflow
or by user2266935
Published on 2013-07-01T15:28:51Z
Indexed on
2013/07/01
16:21 UTC
Read the original article
Hit count: 195
I've got this code here:
class DerivedClass : public BaseClass {
SomeClass* a1;
Someclass* a2;
public:
//constructors go here
~DerivedClass() { delete a1; delete a2;}
// other functions go here ....
};
My first question is as follows: Can I write an "operator=" to "DerivedClass" ? (if your answer is yes, could you show me how?)
My second question is: If the answer to the above is yes, could you show me how to make an "copy c'tor" using the "operator=" that you wrote beforehand (if that is even possible)?
Your help would be much appreciated !
© Stack Overflow or respective owner