2 ms·
Public non-virtual functions may be useful. For example, to provide alternative API functions. Something like: virtual public setOrigin(const Point &p); pu
by killedbydeath 17y ago
Public non-virtual functions may be useful. For example, to provide alternative API functions. Something like:
virtual public setOrigin(const Point &p);
public setOrigin(float x, float y) { setOrigin(Point(x,y)); }
Someone inheriting from this class will know that all the customization is in one function.
- d0m 17y agoStill, I find it more logical to say virtual by default and using another keyword for rare case when you want to specify a non-virtual function.
- alnayyir 17y agoSure, if you learned to code in dynamic langs like Python and Ruby. I didn't, I learned in C. I'd rather take the safe route and non-virtual by default.