Sealed class questions... is there any use for sealed classes in a solo-programmer project? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Sealed class questions... is there any use for sealed classes in a solo-programmer project?

The question on the title is my main question but I've got some more as well. Somebody implied that unsealed classes can be changed by the programmer who inherits them? Can the base class be changed by anybody and affect its behavior outside the class that inherits it? And one more... I've read that hackers may have access to unsealed or unprotected classes. Is that true and what can somebody do to the program?

13th Jul 2017, 11:13 PM
Panagiotis Zografakis
Panagiotis Zografakis - avatar
1 Answer
+ 2
Meh, I use it anyway. It's one of those things that IMO don't matter as much. I've just started making everything sealed, and private, then changing it as I need. I don't get how it makes any difference for 'hackers', we're only talking about inheritance.. I think it'd be decent for group projects where you know this is a fundamental class. Who knows, maybe there's also some performance benefit under the hood. Good info I just found here: https://stackoverflow.com/questions/268251/why-seal-a-class
14th Jul 2017, 4:15 AM
Rrestoring faith
Rrestoring faith - avatar