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
What is class and object in oops?
write a program using c++ to implement single contiguous memory mangement techniques.display the content of the main memory after yhe allocation of jobs and percentage of the wastage of the main memory
Can enum be null?
can we make game by using c
Can you explain polymorphism?
Can a destructor be called directly?
Explain the advantages of inheritance.
What is static in oop?
explain sub-type and sub class? atleast u have differ it into 4 points?
What are the benefits of interface?
What is object-oriented programming? Webopedia definition
What is the difference between static polymorphism and dynamic polymorphism?
What is protected in oop?
What is encapsulation in oops?
What does and I oop mean?