Force implement virtual methods

zeinab mokdad

Member
Joined
Dec 23, 2021
Messages
13
Programming Experience
5-10
Dears,
I have a base class with 2 virtual methods.
How can I force a child class inherited from the base class to override one of these two virtual methods.
 
You can't force override of virtual method, only abstract methods do that (in abstract class).
In the case you don't want base to be abstract you can put an abstract class between them: base (B), abstract (A:B), child (C:A) It is here implied that abstract class override the virtual base method and calls its abstract method, which child implements.
 
Back
Top Bottom