By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,483 Members | 1,612 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,483 IT Pros & Developers. It's quick & easy.

derived class and base class, member assignment, which goes first

P: n/a
Hi,

If I assign in the base class' constructor:
myMember = 5;

and assign in the derived class' constructor:
myMember = 10;

where myMember was derived from the base class,

I get the result of 10.
Is this always true, or does it depend on some random state of the
computer?

Thanks in advance!

Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On 10 Jul 2005 20:22:10 -0700, "user" <b8*******@yahoo.com> wrote in
comp.lang.c++:
Hi,

If I assign in the base class' constructor:
myMember = 5;

and assign in the derived class' constructor:
myMember = 10;

where myMember was derived from the base class,

I get the result of 10.
Is this always true, or does it depend on some random state of the
computer?

Thanks in advance!


It is always true. The base class constructor executes first, then
the derived constructor.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.