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 |
What is the difference between containment and delegation?
What does namespace mean in c++?
What compiler was used?
What is a hash function c++?
If a function doesn’t return a value, how do you declare the function?
what is data Abstraction
Generally variables are stored in heap memory. When he variables are created in stack?
What is the difference between C and CPP?
Why cout is used in c++?
Difference between pointer to constant vs. Pointer constant
What is the cout in c++?
How do you remove an element from a set in c++?