|
-
June 2nd, 2013, 09:25 AM
#2
Re: operator overloading and inheritance
It would help if you indent your code properly and explained how does the relevant code not work. A simple and short program that we can compile and run, with the expected output and your actual output, would be excellent.
 Originally Posted by tuli
The "official" copy-constructor wont work (as far as i see, it calls B's default constructor instead).
You are aware that you can invoke the base class copy constructor in the initialisation list of the copy constructor of a derived class, right?
Furthermore, it is more conventional to implement the copy assignment operator using the copy constructor (and maybe the destructor and a swap function) rather than implement the copy constructor using the copy assignment operator.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|