OPP Basic--if virtual functions are so powerful, can we declare all member functions virtual?
A:
Never. cos virtual functions has costs. Each object of virtual function must have a v table to manage them.Therefore using virtual function will need system costs. for only a very small class and dont wanna derive other classes, then it's no need to use virtual functions in this class at all.
Never. cos virtual functions has costs. Each object of virtual function must have a v table to manage them.Therefore using virtual function will need system costs. for only a very small class and dont wanna derive other classes, then it's no need to use virtual functions in this class at all.