Private constructor, subclassing and printing
If you can prevent subclassing by declaring a private constructor in the base class, why do we need a sealed keyword? Is it because the CLI can optimize it better? may be.
Thank.
+2
ra170
source
to share
2 answers
As you might want to have public constructors, but not let anyone infer from your class
+9
Sean
If the class is sealed, some optimizations can be performed. those. clr can emit .call instruction, not .callvirt
+2
MaLio