© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
20 replies
Adam

Structure of system with polymorphism

I have a
Grid
Grid
with
Cell
Cell
s, each
Cell
Cell
has a
CellEntities
CellEntities
list of
CellEntity
CellEntity
. Each
CellEntity
CellEntity
has a data object called
CellEntityData
CellEntityData
. Classes that derive from
CellEntity
CellEntity
will have different functions, they could have different types of
CellEntityData
CellEntityData
, but the way I have things set up right now that's not necessary, but might be in the future.

But the important part is to be able to differentiate between different
CellEntity
CellEntity
classes because I want
Cell
Cell
to do different things depending on the
CellEntity
CellEntity
(namely Instantiate different GameObjects in unity, among other things)

What is the best way to go about implementing entities with this framework?
Should
CellEntity
CellEntity
and
CellEntityData
CellEntityData
be interfaces? Abstract classes?
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

Polymorphism
C#CC# / help
2y ago
❔ Polymorphism
C#CC# / help
3y ago
❔ Polymorphism
C#CC# / help
4y ago
Inheritance and polymorphism
C#CC# / help
5mo ago