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


Please Help Members By Posting Answers For Below Questions

What is Difeerence between List obj=new ArrayList(); and ArrayList obj=new ArrayList()?

2106


What are oops functions?

583


what is different between oops and c++

2001


What is interface in oop?

664


is there any choice in opting subjects like 4 out of 7

1731






i=20;k=0; for(j=1;k-i;k+=j<10?4:3) { cout<

1417


What is the renewal class?

2169


Is html an oop?

582


Why do we use inheritance?

628


What are the features of oop?

641


write a program to find 2 power of a 5digit number with out using big int and exponent ?

1895


explain sub-type and sub class? atleast u have differ it into 4 points?

1836


Why do while loop is used?

577


Why is static class not inherited?

599


What is persistence in oop?

673