Skip to main content
2 of 4
added 482 characters in body
Robert Harvey
  • 200.7k
  • 55
  • 470
  • 683

This is where encapsulation pays off.

If you have functionality that's encapsulated in a method or class, that's written in the old MFC style, and you instantiate or call it using new-style code, will it still work?

Treat your old code like the black box that it's supposed to be, and you can have it both ways.


To be clear, I think you should leave your old code the way it is (it's tested, after all), and write your new code using your new style. If everything is properly encapsulated, having two code styles in the same code base should not matter at all.

On a case-by-case basis, consider fixing the old-style code gradually so that it conforms to the new style guidelines. You can choose to do this when a class or method is in need of refactoring, or when you need to change its functionality.

Robert Harvey
  • 200.7k
  • 55
  • 470
  • 683