The same result occurs whether they are polymorphic or not. The behaviour I want is for the function f to change both the values of a and b when f is called on derived class B, i.e. I want f to both behave as it would for its parent class A and for B when called on B. How to achieve this without defining two separate functions, or pasting the entire code in A again? Of course, I actually have chains of classes with myriads of data members that I want this property for, especially since I'm constantly adding new data members (so updating the virtual functions to maintain this property is a headache, and easy to forget to do too).