Skip to main content
2 of 5
added 17 characters in body
Doc Brown
  • 220.3k
  • 35
  • 410
  • 623

Sprites contain pixel data

which is a clear sign of a "has a" relationship, not an "is a". So bite the bullet and make Sprite -> Resource a composition.

Why not composition? Because I'd still have to implement methods in Sprite (and similar classes) that essentially call the methods of Resource

yes, you will - but only trivial delegation methods. You won't have to repeat any functional code. That's actually acceptable. and the standard way composition works. Here you find a detailed example how to replace inheritance by delegation.

Doc Brown
  • 220.3k
  • 35
  • 410
  • 623