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
What are separators in c++?
What is the difference between the compiler and the preprocessor?
What is the difference between #import and #include?
What is the difference between while and do while loop? Explain with examples.
an operation between an integer and real always yeilds a) integer result b) real result c) float result
What is a tree in c++?
Is c++ map a hash table?
What does the linker do?
Perform addition, multiplication, subtraction of 2-D array using Operator Overloading.
Explain one-definition rule (odr).
Can create new c++ operators?
What is an html tag?
Is c better than c++?
Give an example of run-time polymorphism/virtual functions.
What do you mean by a template?