It is my understanding that in C++ objects of derived classes invoke the derived class' constructor but before the body is executed the base class' constructor is invoked and takes effect and then the derived class' constructor's body is executed. If this knowledge is correct, then what happens if the base class' constructor initializes a private variable of the base class that would not be inherited to the derived class, when a new objecct of the derived class is declared.
CPPRULZ
0
Junior Poster in Training
Recommended Answers
Jump to PostIt is my understanding that in C++ objects of derived classes invoke the derived class' constructor but before the body is executed the base class' constructor is invoked and takes effect and then the derived class' constructor's body is executed. If this knowledge is correct, then what happens if the …
Jump to PostIt is my understanding that in C++ objects of derived classes invoke the derived class' constructor but before the body is executed the base class' constructor is invoked and takes effect and then the derived class' constructor's body is executed. If this knowledge is correct, then what happens if the …
All 7 Replies
Intrade
33
Junior Poster
ArkM
1,090
Postaholic
CPPRULZ
0
Junior Poster in Training
Intrade
33
Junior Poster
ArkM
1,090
Postaholic
CPPRULZ
0
Junior Poster in Training
ArkM
1,090
Postaholic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.