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


Please Help Members By Posting Answers For Below Questions

What does extern mean in a function declaration in c++?

800


What does obj stand for?

731


What is capacity in vector in c++?

640


To what does “event-driven” refer?

712


Distinguish between a # include and #define.

754






What is the full name of logo?

694


daily Routine of father

1015


Is c++ a programming language?

682


Is it possible to pass an object of the same class in place of object reference to the copy constructor?

653


Difference between pass by value and pass by reference?

696


Can I learn c++ as my first language?

742


Comment on c++ standard exceptions?

728


What is pointer -to-members in C++? Give their syntax?

688


Difference between strdup and strcpy?

757


Is rust better than c++?

703