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 / prasenjit roy
4. To ensure that A cannot be created/copied outside the
inheritance chain
| Is This Answer Correct ? | 6 Yes | 0 No |
Can I learn c++ without c?
What is function overriding?
Is std :: string immutable?
What is a lambda function c++?
What are mutator methods in c++?
Should a constructor be public or private?
What are the different types of polymorphism?
what is oops and list its features in c++?
Why is standard template library used?
Is c++ faster than c?
Enter n no. of element and delete value from desire position
3- Write a program to find larger and smaller of the two numbers.