Consider the following class:
class X {
};
One can easily inherit from this:
class Y : public X {
};
Okay so far... Let's say we don't want anyone to inherit from Y
we can then do this instead.
class Y sealed : public X {
};
Or we could do this:
class Y final : public X
};
What are the main differences between the two keywords final
and sealed
? I know their basic purposes and what they are used for; I just wanted to know if there was anything specifically different between the two.