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 ArticleBy: 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 ArticleBy: 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 ArticleBy: 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 ArticleBy: 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 ArticleBy: 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 ArticleBy: 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 ArticleBy: 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 ArticleBy: Bob
Thank you very much! this was EXACTLY what I was looking for. Very informative and well written.
View ArticleBy: 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 ArticleBy: 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 ArticleBy: 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 ArticleBy: 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 ArticleBy: 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