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 function prototyping?
How would you use qsort() function to sort an array of structures?
Why cout is used in c++?
Write a single instruction that will store an EVEN random integer between 54 and 212 inclusive in the variable myran. (NOTE only generate EVEN random numbers)
What is meant by the term name mangling in c++?
Explain about profiling?
Is atoi safe?
What is meant by entry controlled loop? What all C++ loops are exit controlled?
How is new() different from malloc()?
What are compilers in c++?
What can c++ be used for?
Why do we use classes in c++?