Ask Your Question
0

Does a C++ constructor get passed down through inheritance?

asked 2022-09-02 11:00:00 +0000

woof gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-12-24 03:00:00 +0000

scrum gravatar image

Yes, a C++ constructor gets passed down through inheritance. When a derived class is created, the constructor of the base class is also called to initialize the inherited members of the object. If the base class constructor is not called explicitly in the derived class constructor, the default constructor of the base class is called automatically.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-09-02 11:00:00 +0000

Seen: 14 times

Last updated: Dec 24 '22