How would you stop a class from class from being derived or
inherited.
Answer Posted / abhijit
class ASealedClass;
class MyFinalClass
{
friend ASealedClass;
private:
MyFinalClass(int dummy) {}
};
class ASealedClass : virtual MyFinalClass
{
public:
ASealedClass() : MyFinalClass(0) {} // this is the key .. it
is the virtual inheritance that prevents inheritance
};
| Is This Answer Correct ? | 1 Yes | 4 No |
Post New Answer View All Answers
Why oops is important?
Why do we use oops?
Can we create object of abstract class?
Why is it so that we can have virtual constructors but we cannot have virtual destructors?
#include
What is difference between pop and oop?
write knight tour problem which is present in datastructure
What is polymorphism programming?
State what is encapsulation and friend function?
write a program to find 2 power of a 5digit number with out using big int and exponent ?
Get me a number puzzle game-program
Templates mean
is there any choice in opting subjects like 4 out of 7
Why is abstraction needed?
officer say me - i am offered to a smoking , then what can you say