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
Templates mean
Why oops is important?
What are different types of JVM's? for example we use dalvik jvm for android then what about the remaining operating systems?
What does and I oop mean in text?
What are different oops concepts?
What is property in oops?
What is the advantage of oop over procedural language?
What is polymorphism in oops with example?
What are classes oop?
Why is oop better than procedural?
What are the important components of cohesion?
What are the 3 pillars of oop?
Why can't we have instance(stack) of a class as a member of the same class like eg.Class A{A obj;} as we can have self refential pointer
Are polymorphisms mutations?
What is polymorphism oop?