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 |
Tell me difference between constant pointer and pointer to a constant.
Why do we need constructors in c++?
How Virtual functions call up is maintained?
What is the outcome of cout< a) 16 b) 17 c) 16.5
What is #include cmath?
Write a function to find the nth item from the end of a linked list in a single pass.
How do you import payscale data from non SAP to SAP?is it through LSMW or any other way is there?
write a program in c++ to generate imp z y x w v w x y z z y x w x y z z y x y z z y z z
How to declare an array of pointers to integer?
Is linux written in c or c++?
What is the difference between operator new and the new operator?
What are friend classes? What are advantages of using friend classes?