In many programming languages, you can prevent a class from being inherited by using the sealed (C#) or final (Java) modifier. This modifier restricts the inheritance of a class, ensuring that no other class can extend or inherit from it. Here’s an example in both C# and Java:

sealed class SealedClass
{
  // Class members and methods
}
final class FinalClass {
  // Class members and methods
}