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 the example of polymorphism?

566


write a program that takes input in digits and display the result in words from 1 to 1000

1997


What is oops?what is its use in software engineering?

565


I have One image (means a group photo ) how to split the faces only from the image?............ please send the answer nagadurgaraju@gmail.com thanks in advace...

1636


write a code for this. serial_number contained in the header of the file will be read , if this serial number is less than a previous serial number within a successfully processed file, or is the same as another serial number within a successfully processed file, or if the field contains anything other than 7 digits, then the file must error with the reason ‘Invalid SERIAL_NUMBER’.

1790






What is object in oop?

697


Explain the concepts involved in Object Oriented programming.

651


Why is abstraction needed?

575


write knight tour problem which is present in datastructure

2172


What is the point of oop?

664


Why do we use polymorphism in oops?

593


How do you achieve polymorphism?

622


How to use CMutex, CSemaphore in VC++ MFC

4340


What is a class and object?

602


What is polymorphism and its types?

607