samedi 28 novembre 2015

When creating an instance of child class, is an instance of the parent class being made too?

When creating an instance of child class, is an instance of the parent class being made too?

If not then the child only have access to static public (and protected) functions of the parent?

For example:

class a {
public:
    void baz();
    class b {
    public:
        void foo();
    };
};

int main(){ 
    a::b bar; //is an instance of a being made too?
    bar.foo();
}

Aucun commentaire:

Enregistrer un commentaire