Hi,

I don't get the meaning of this question: change B and C inheritance to public and protected respectively

This are the classes and their inheritances that I have:

class A
{
public: 
    int a;
    A();                //default constructor
    A(int, int, int);   //another constructor
    ~A();               //destructor
    void printA();      //printA
protected: 
    int b;              
private:                    
    int c; 
}; 


class B: public A 
{
public: 
    string e;
    B();                        //default constructor
    B(string, string, string);  //another constrctor
    ~B();                       //destructor
    void printB();              //printB
protected: 
    string f;               
private:                    
    string g; 
};



class C: public B 
{
public: 
    string x;
    C();                        //default constructor
    C(string, string, string);  //another constructor
    ~C();                       //destructor
    void printC();              //printB
protected: 
    string y;               
private:                    
    string z; 
};

you would change line 32 to

class C : protected A

NathanOliver,

shouldn't it be
class C: protected B

since the question is change B and C inheritance to public and protected respectively. That is just my opinion, I don't know

change B and C inheritance to public and protected respectively

This means that B needs to have public inheritance and C needs to have protected inheritance. They still inherate from the same object just the type of inheritance changes

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.