In C# and C++/CLI the keyword sealed
(or NotInheritable
in VB) is used to protect a class from any inheritance chance (the class will be non-inheritable). I know that one feature of object-oriented programming is inheritance and I feel that the use of sealed
goes against this feature, it stops inheritance.
Is there an example that shows the benefit of sealed
and when it is important to use it?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…