Quantcast
Channel: Comments on: 11.4 — Constructors and initialization of derived classes
Browsing all 159 articles
Browse latest View live

By: Tary

Great tutorial… Helped me so much. Much appreciated. Keep it up.

View Article


By: Adam

Thank you for the tutorial, very useful so far.

View Article


By: sdg

One of the great things about this site is that many of the subjects are explained in ways that are readily understandable. This is certainly not often the case when learning C++. Many times I have had...

View Article

Image may be NSFW.
Clik here to view.

By: Tomas Vasko

Outstanding explanation, simplicity and intelligibility. U should write an whole book Basically this whole tutorial is shining example how the education materials for beginners should looks like....

View Article

By: Avneet

"The means every BaseballPlayer we create is going to use the default Person constructor, which will initialize the name to blank and age to 0" ‘This’ or ‘That’ is expected instead of ‘The’. Typo made...

View Article


By: Alex

Fixed, thanks again.

View Article

By: Avneet

1. In section "initializing base class members": "What if we want to set both m_dValue (from the Derived potion of the object) and m_nValue (from the Base portion of the object) when we create a...

View Article

By: Alex

1) Thanks for noticing the typo. I guess I drank too many potions when I wrote this. 😛 2) The term “default constructor” refers to any constructor that can be called with no arguments. The means a...

View Article


By: vish

Hey alex it is clear that in chaining classes i can initialize the base object in other class object through constructor but if chains got long how will i initialize default constructor to every class?...

View Article


By: Alex

Sorry, I am not understanding what you are asking. Assuming you have class C inherit from B, and B inherit from A. When you pass parameters to C’s constructor, C can call B’s constructor, which in turn...

View Article

By: Matt

Typo: "Because const variables must be initialized with a value at the time of creation, the base class constructor must set it’s value when the variable is created." "it’s" should be "its"

View Article

By: Alex

Fixed. Thanks!

View Article

By: Bob

Thank you very much! this was EXACTLY what I was looking for. Very informative and well written.

View Article


By: chump

123 Derived derived(1.3, 5); // use Derived(double) constructorstd::cout << "Id: " << getId() << '\n';std::cout << "Cost: " << getCost() << '\n'; I think you meant:...

View Article

By: Alex

Fixed. Thanks for pointing that out.

View Article


By: Matt

In section "Initializing base class members", in the forth code example, you commented: "// use Derived(double) constructor". I think it should say "use Derived(double, int) constructor".

View Article

By: Alex

Fixed. Thanks for noticing.

View Article


By: Bruno Teles

Maybe there’s going to be something about this later, but I tried to implement the quiz solution by having the overloaded << operator be a friend function and access the private members directly...

View Article

By: Alex

I think I answer this question in the very next lesson, where I talk more about how access specifiers work with derived classes. > Why does it tell me Fruit::m_name and m_color is private?...

View Article

By: Bruno Teles

Yep, that works. So that’s what protected’s for, huh? Don’t spoil it for me, I guess you’ll be talking about it in future lessons, which I’mdefinitely taking. 🙂

View Article
Browsing all 159 articles
Browse latest View live