© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
100 replies
Bobby Bob

Confused about is-a relationship (static and dynamic types) [Answered]

// Testing
BaseClass newObject = new BaseClass();
BaseClass newObjectB = new DerivedClass(209.21312f);
// Testing
BaseClass newObject = new BaseClass();
BaseClass newObjectB = new DerivedClass(209.21312f);


What's with the syntax on the second line? And why would we ever use the syntax on the second line if it limits us to using only the members in DerivedClass? Like is

BaseClass newObjectB = new DerivedClass(209.21312f);
BaseClass newObjectB = new DerivedClass(209.21312f);


The same as
BaseClass newObjectB = new BaseClass(209.21312f)
BaseClass newObjectB = new BaseClass(209.21312f)
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
Next page

Similar Threads

Confused about interface default implementations [Answered]
C#CC# / help
4y ago
Static vs Non-Static classes [Answered]
C#CC# / help
4y ago
✅ confused about classes
C#CC# / help
3y ago