1.

Assume a class Derv derived from a base class Base. Both classes contain a member function func() that takes no arguments. Write the definition for a member function of Derv that calls both the func()s.

Answer»

class Base

{

public:

void func()

{

cout<<"base class";

}

};

class Derv:public Base

{

public:

void func()

{

cout<<"derived class";

}

void callAll()

{

Base::func();

func();

}

};



Discussion

No Comment Found

Related InterviewSolutions