0

When is sealed better to use than protected?

When and where is a sealed class good to use. What's a good application of sealed classes?

16th Jun 2017, 3:12 PM
MrTigeriffic
MrTigeriffic - avatar
2 Respuestas
+ 6
when you don't want a class be inheritable you use sealed modifier, for example when you don't want other programmers inherit from your class or when you have static members in class. when you use protected modifier, only derived classes can call the class members, no any other classes.
16th Jun 2017, 3:30 PM
Saeede
Saeede - avatar
+ 1
yep same as above couldn't have said it better than Saeede Did
3rd Jul 2017, 8:29 AM
Stefan Dowbenko
Stefan Dowbenko - avatar