inheritance vs nested class

Suppose i want to create a Resources class. There are three type of resources: string resources, drawable resources, xml resources. Which one is better to implement the resources class: inheritance or nested class ? With inheritance, i create abstract class Resources, then create another class for each type of resources which inherit from Resources. With nested class, i create a static class Resources, then create a non-static class inside the Resources class for each resources types. For example, Resources.String, Resources.Drawable, etc.
3 Replies
say | firefly fanatics
Each class only share a small amount of functionally and is mostly different from each other.
Angius
Angius3w ago
Well, in the first case you can have a List<Resource> that can contain StringResources and DrawableResources both In the second case... not
say | firefly fanatics
Ah yes i forgot about that txn
Want results from more Discord servers?
Add your server