Why is the constructor called from top to bottom rather than bottom to top ????
abhi74k 0 Newbie Poster
Recommended Answers
Jump to PostI don't really see how knowing "why" actually helps, although if you think about what inheritance represents, it should be obvious - a base class represents generalised components which are common to all objects in a heirarchy - essentially a base class is a 'sub set' of its derived classes …
Jump to PostWell the main problem with starting the construction of a class from the derived part up to the base is that any variables you are using that are in your base in a function in your derived class would be undefined. Assume this situation.
class A { …
Jump to PostWell the main problem with starting the construction of a class from the derived part up to the base is that any variables you are using that are in your base in a function in your derived class would be undefined. Assume this situation.
class A { int …
All 9 Replies
mrnutty 761 Senior Poster
Radical Edward 301 Posting Pro
abhi74k 0 Newbie Poster
Bench 212 Posting Pro
abhi74k 0 Newbie Poster
NathanOliver 429 Veteran Poster Featured Poster
Bench 212 Posting Pro
Bench 212 Posting Pro
abhi74k 0 Newbie Poster
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.