class A {
public:
void f();
protected:
A() {}
A(const A&){}
};
Examine the class declaration shown above. Why are the
default and copy constructors declared as protected?
1. To ensure that A cannot be created via new by a more
derived class
2. To ensure that A cannot be copied
3. To ensure that A cannot be used as a base class except
when public inheritance has been used
4. To ensure that A cannot be created/copied outside the
inheritance chain
5. To ensure that A cannot be instantiated as a static variable
Answer Posted / prasenjit roy
4. To ensure that A cannot be created/copied outside the
inheritance chain
| Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
Write a program using display() function which takes two arguments.
What is a sequence in c++?
What are the benefits of operator overloading?
Write about the various sections of the executable image?
What is DlgProc?
What is an operator in c++?
What is c++ coding?
Should the this pointer can be used in the constructor?
What are abstract data types in c++?
Why do we use classes in c++?
How a pointer differs from a reference?
Mention the purpose of istream class?
Differentiate between a template class and class template in c++?
What is setbase c++?
Write about the retrieval of n number of objects during the process of delete[]p?