C#C
C#14mo ago
Potassium

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.
Was this page helpful?