I have a little question, that which answer may mean death to my class plans.

I have a superclass (or parent class if you will) that I have to delete when I'm done with it, but does that affect the subclass (or child class if you will)?

Simple question, hope the answer is as simple :D


Its not possible to delete just the parent -- when you delete the child then parent gets deleted too. Both parent and child form a single object, not two.

commented: Quick, straight as always :D Thanks. +1

Okey then. Just had that impression, because I would use two constructors :)

Would you happen to be in such a good mood, you could tell me one more thing? :D
I'm wondering if I in a third class have set my parent class as friend, so that the parent class have access to the third class's protected functions. Does the child class have access to those, too then?

>>oes the child class have access to those, too then?

>>oes the child class have access to those, too then?

Great, thanks :) :)

>superclass (or parent class if you will)
>subclass (or child class if you will)

It's generally better to use the established terminology rather than equivalent terminology from another language. The C++ standard uses "base" for superclass and "derived" for subclass. Superclass and subclass have traditionally been very confusing, though I'll admit parent and child are also commonly used in the C++ community. So in order of preference with those three options:

  1. Base-Derived
  2. Parent-Child
  3. Super-Sub

Ahh thanks, useful info there - also always wondered what was ment with Derived :)