© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
26 replies
KKSK@🌸🎵🌸🎵🌸

❔ cast parent to child

Have a problem about inheritance.
I have an interface that are shared between a net framework project and net 6 project.
Some of methods are called by passing classA object.
My idea was to have classB inherits classA so that in the net framework project I can call the method by passing classA.
And in the Net 6 project I can cast classA to classB (parent to child).
classA is a class with only some enum and properties.
classB have some methods that uses libraries which might not be compatible in net framework.
However, I learnt from some places that parent to child is not allow
Where some places says it is possible by using as and is keyword.
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

Cascading delete from child to parent
C#CC# / help
2y ago
❔ ✅ abstract-Parent and Child static overrides?
C#CC# / help
3y ago
✅ (beginner) Align child to left, parent to the middle
C#CC# / help
2y ago
child/parent class, how do i 'mass define' child properties?
C#CC# / help
2y ago