3 ms·
Make Dog implement Healable, duh.
by throwaway889900 5y ago
Make Dog implement Healable, duh.
- dTal 5y agoThe original author can do that. Another author cannot add that functionality later, as a library. The can only define a new kind of dog.
- throwaway889900 5y agoSubclass Dog into MyDog, which is exactly the same as Dog. From there, use and modify MyDog as though you would be modifying Dog. Any class that references base class Dog isn't modifiable, but any future work you can use MyDog instances to get all the functionality you need (with some ugly casting). There are other solutions as well.