I do not think this is possible, simply by design. I mean, the superclass doesn't know anything about its subclasses, so I don’t see how it can be.
Now, when you talk about the life cycle, maybe you have some methods start()and stop()? If so, why not use another method in the superclass, say finalCheck()one that cannot be overridden in a subclass and that checks to see if your methods have been called or not, maybe just use some fields of the class bool. I know that this does not guarantee anything, but at least it can be checked at runtime.
, , -. , :
abstract class Parent {
void mustDo1() { }
void mustDo2() { }
abstract void do() { }
}
class Child : Parent {
override void do() {
base.mustDo1();
base.mustDo2();
}
}
- :
abstract class Parent {
void mustDo1() { }
void mustDo2() { }
void do() {
this.mustDo1();
this.customDo();
this.mustDo2();
}
abstract void customDo() { }
}
class Child : Parent {
override void customDo() {
}
}