Sealed classes and methods: Difference between revisions

Removed mention of private methods in description
(C++ entry)
(Removed mention of private methods in description)
Line 6:
Classes are sometimes made non-subclasssable in this way if the author feels that it would not be useful or even undesirable for subclasses to be created from them. Moreover, in a compiled language, knowing that a class cannot be subclassed, may enable optimizations to be made.
 
Rather than sealing the entire class, it may be possible to just seal certain 'public' methods for the same reasons and with the same potential benefits. 'private' methods should be effectively sealed anyway.
 
;Task
125

edits