I have 2 classes(Model). I want to use some properties in parent class, which are defined in child. Is it possible?
Parent Class:
class Model{
constructor() {
//I need the table name here. which is defined in child.
}
public static getAll(){
return 'From Root Model';
}
}
export default Model;
Child Class:
import Model from "../providers/Model";
class Product extends Model{
public table="products";
}
export default Product;
In my controller I am calling as like this.
import Product from "../model/Product";
...
Product.getAll();
I am new in OOP. Is it possible?