How would you stop a class from class from being derived or
inherited.
Answer Posted / anant tiwari
There are three way to stop a class been derived (example in C#)
1) declare a class as static (Ex : static class Sample {....}
2) declare the class constructor as private (Ex class Sample{ private Sample(){}....}
3) declare a class as sealed class Ex : sealed class Sample {...}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is encapsulation with real life example?
What causes polymorphism?
What is the oops and benefits of oops programming?
to find out the minimum of two integer number of two different classes using friend function
What is the fundamental idea of oop?
Why polymorphism is used in oops?
What are the three main types of variables?
What is abstraction in oop with example?
Why multiple inheritance is not allowed?
What is overloading in oop?
What is inheritance in simple words?
how to get the oracle certification? send me the answer
What is the point of oop?
What is polymorphism what are the different types of polymorphism?
How to handle exception in c++, For example in a functions i am assigning memory to some variables and also in next instructions in am dividing one variable also. If this functions generates a error while allocating memory to those variable and also while dividing the variable if i divide by zero then catch block how it will identify that this error has cone from perticular instruction