© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•16mo ago•
4 replies
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.
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ Nested Record Inheritance
C#CC# / help
10mo ago
❔ Struct vs Class
C#CC# / help
3y ago
✅ Difference between OOP concept, inheritance vs polymorphism
C#CC# / help
9mo ago