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

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 Article


By: 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 Article


By: Rakesh

Thanks for the clarification :). This tutorial is excellent. Made so easy to understand. Thanks a lot.

View Article

By: Ian S

Will this website eventually contain material explaining how to multi-thread and create your own library in C++?

View Article

By: 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 Article


By: john

Typo in "the compiler will error."

View Article

By: 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 Article

By: Alex

Generally doesn’t matter so long as all the types can be resolved.

View Article


By: 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 Article


By: 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 Article

By: Moj

Alex for the quiz problem I neglected to write the &quot;const&quot; in these lines: 12 string getName() const { return m_name; }string getColor() const { return m_color; } and compiler refused...

View Article

By: Alex

Yes, that’s correct.

View Article

By: 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 Article


By: 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 Article

By: 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 Article


By: 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 Article

By: 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 Article


By: 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 Article

By: 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 Article

By: 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
Browsing all 159 articles
Browse latest View live