How can I get properties of a child class in an abstract class's method?
abstract class Parent {
id: string;
logProps() {
// HOW can I log all properties of a child class
// and their values? For example, the name.
}
}
class Child extends Parent {
name: string;
constructor(name) {
super();
this.name = name;
}
}
const child = new Child("Daniel");
child.logProps();
Aucun commentaire:
Enregistrer un commentaire