Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ensure that a class is not abstract

When I change the signature of a virtual method, it happens quite frequently, that inheriting classes become abstract. This might lead to (confusingly large) error messages at apparently completely unrelated (to the original change) locations. Somewhere in these messages, I read "Foo is abstract". But parsing these error messages is tedious. Is there a way to enforce that a class is not abstract?

like image 250
choeger Avatar asked Jan 04 '23 03:01

choeger


1 Answers

You can use the override specifier to specify that a method in the derived class overrides the abstract method in the base class. When you change the signature of the method in the base class, the override specified method should cause a clear compiler error because because it no longer overrides the base class method.

like image 150
463035818_is_not_a_number Avatar answered Jan 13 '23 11:01

463035818_is_not_a_number