A question about complier for C++

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I want to know :

Do the copy assignment operator and copy constructor in derived class
will automatically invoke the corresponding functions in base class?

that to say:

class A have a copy constructor and a copy assignment funciton.
And class B is derived from class A, and also define a copy constructor
and a copy assignment funciton.

class A
{
//...
public:
A:A(const A& rhs);
A& operator=(const A& obj);
};

class B:public A
{
public:
B:B(const B& rhs);
B& operator=(const B& obj);
};

When I call the B:B or B& operator= function, will the compiler invoke
the A:A or A& operator= function automatically?

Or I need explicit invoke the A:A or A& operator= in B:B or B& operator=?



Thanks!



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux