کلیدواژه مهر و موم شده(The sealed Keyword)

اگر نمی‌خواهید کلاس‌های دیگر از یک کلاس ارث ببرند، از کلمه کلیدی sealed استفاده کنید:



If you try to access a sealed class, C# will generate an error:



sealed class Vehicle 
{
...
}

class Car : Vehicle
{
...
}

The error message will be something like this:




'Car': cannot derive from sealed type 'Vehicle'