I have three classes (or more) with the followings inheritance:
- class A (abstract class)
- class B extends A
- class C extends B
I want to add a service in the class A to implement a function that use notifications, how can I do this without adding in any sub-classes the service?
My solution is similar to this draft but I would avoid to import the service in the subclasses:
export class abstract A {
constructor(protected service: NewService) {}
}
export class B extends A {
constructor(protected service: NewService) {
super();
}
}
export class C extends B {
constructor(protected service: NewService) {
super();
}
}