By: Rakesh
Hi, for the below summary "When constructing a derived class, the derived class constructor is responsible for determining which base class constructor is called. If no base class constructor is...
View ArticleBy: Alex
C++ will only create a default constructor if there are no other constructors. So in the case where the base class has a non-default constructor, and the derived class does not call that constructor,...
View ArticleBy: Rakesh
Thanks for the clarification :). This tutorial is excellent. Made so easy to understand. Thanks a lot.
View ArticleBy: Ian S
Will this website eventually contain material explaining how to multi-thread and create your own library in C++?
View ArticleBy: Alex
I do not currently have lessons on these topics. I hope to get there some day, but I doubt it will happen soon.
View ArticleBy: Mohammad
Hello, if im overloading an operator, and using a friend function to do it, does it matter if the body is included inside the class or outside the class? does it make a difference?
View ArticleBy: Anon Wibble
I wanted to know one thing, which your page did not explain. I wanted to know how to declare a constructor for an inherited class, but has the definition for that constructor outside of the class.
View ArticleBy: Alex
The same way you'd define the constructor outside of the class for a non-derived class. There's an example of how to do so <a...
View ArticleBy: Moj
Alex for the quiz problem I neglected to write the "const" in these lines: 12 string getName() const { return m_name; }string getColor() const { return m_color; } and compiler refused...
View ArticleBy: Omri
Hello Alex, A "revelation": It seems that when we "go private" with the parent class member variables, their accessibility by the child class is no longer as if they were private variables of the...
View ArticleBy: Alex
You are kind of correct. Child classes _do_ inherit the private members of the base class, but simply have no access to them. Those members do still exist though, as they may be used by functions in...
View ArticleBy: Sivasankar
Hi Alex, Thank You once again for your wonderful tutorials. Before Destructors section, you said "It is worth mentioning that constructors can only call constructors from their immediate parent/base...
View ArticleBy: Alex
No. Constructors always call parent constructors, not the other way around. This makes sense when you have Base and Derived. A Derived always has a Base, so the Derived (child) constructor can call the...
View ArticleBy: Sivasankar
Ok. I got it. Thank You very much for clearing my doubt. By the way, I have a non-technical suggestion for this blog UI which might be helpful. I open the blog at least thrice a day. It will be very...
View ArticleBy: Alex
That’s an interesting idea. I’m not quite sure how to enable such a thing on a per-user basis though. I’ll put it on my to-do to look into, but not sure how soon I’ll be able to get to it. Thanks for...
View ArticleBy: Lamont Peterson
Alex, You have this sentence in the middle of this lesson: "As you can see, the name and age in the base class were properly initialized, as was the number of home runs in the derived class." I’m...
View ArticleBy: Alex
I think you’re right, that saying “from” rather than “in” is slightly more correct, as the members actually exist within the instantiated object, not the class definition itself.
View Article