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 |
When the design recommends static functions?
What do you mean by overhead in c++?
Search for: what is pair in c++?
A prime number is a number which is divisible only by itself and 1. Examples of the first few primes are 2, 3, 5, 7, 11. Consider writing a program which can generate prime numbers for you. Your program should read in and set a maximum prime to generate and a minimum number to start with when looking for primes. This program should be able to perform the following tasks: 1. Read the maximum number from user (keyboard input) to look for primes. The program should not return any primes greater than this number. 2. Read the minimum number from user (keyboard input) to look for primes. The program should not return any primes less than this number. 3. Generate and print out every prime number between the maximum prime and minimum number specified by the user.
Why is main an int?
What is a pointer with example?
How many bit combinations are there in a byte?
Differentiate between a deep copy and a shallow copy?
Explain polymorphism?
write a program to insert an element into an array
Does c++ have arraylist?
What are different types of loops in c++?