I have a class called Ship and a class called Lifeboat
Lifeboat is inherited from Ship.
The ship contains a method called Validate() , which is called before saving and has an abstract method called FurtherValidate() , which it calls from Validate. The reason for this is that when you call validate on the base, it also validates the class that inherits. So we have
public class Ship public bool Validate() {
So Lifeboat has
public override bool FurtherValidate() {
This means that anyone who implements Ship must also provide their own verification for their class, and they are guaranteed to be called up for storage as a base ship. Validate() , which in turn calls an inherited check.
How can we do this, so we still force the inherited classes to implement FurtherValidate() , but FurtherValidate() never be called by the programmer. You can currently call Lifeboat.FurtherValidate() , and I want to somehow prevent this.
source share