I am doing a project and I need a parent class (heritage) to force its daughter classes to have a certain attribute. It is possible to do this?
If the mother class has an attribute, all daughters will have it. It is not clear.
– Woss
Pq there is a method that all daughter classes have to perform at the time of their creation, and this function needs an attribute that it must clone from a prototype. I wanted to make sure he forces his daughters to seek that attribute.
– Carlos Costa Luis
No constructor? Simply call the parent class when creating the constructor (
public SubClass(int param) : SuperClass(int param) { ... }
)– Leonardo Alves Machado