Here is an abstract class definition:
abstract class MenuItemBase implements MenuItem {
constructor() {
stream$.subscribe(() => {
this.activate();
});
}
}
A concrete child class example is as follows:
export class MenuLayer extends MenuItemBase {
activate(): void {
// Implement the activation logic here
}
}
Can we call the child method this.activate();
from the abstract class when data arrives?
I decided to move the stream subscription to the abstract class to avoid duplication in each child class.