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
Can a destructor be called directly?
What is the types of inheritance?
write a code for this:trailer recordId contains a value other than 99, then the file must error with the reason ‘Invalid RECORD_ID’(User Defined Exception).
What is Difeerence between List obj=new ArrayList(); and ArrayList obj=new ArrayList()?
What is polymorphism programming?
Question: Write a program that prints a paycheck. Ask the program user for the name of the employee, the hourly rate, and the number of hours worked. If the number of hours exceeds 40, the employee is paid “time and a half”, that is, 150 percent of the hourly rate on the hours exceeding 40. Be sure to use stepwi se refine ment and break your solution into several functions. Use the int_name function to print the dollar amount of the check.
How to hide the base class functionality in Inheritance?
What is oops and its features?
What is debug class?what is trace class? What differences are between them? With examples.
What is methods in oop?
which feature are not hold visual basic of oop?
What are the advantages of polymorphism?
Can an interface inherit a class?
How long to learn object oriented programming?
if i have same function with same number of argument but defined in different files. Now i am adding these two files in a third file and calling this function . which will get called and wht decide the precedence?