Let's say I create an array of a dog class. That dog class has member functions, such as eat, sleep etc. Those functions are the same for every instance in the array. To me that seems like a huge waste of memory. How can this be improved?
It seems like a pointer to the eat and sleep functions would be better, but I'm coming from a C background so I would rather ask the experts rather than reinvent the wheel.