© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
6 replies
DustinMarino

❔ Question about data types and classes

object cube1 = new Cube(7);
what exactly happens here when i have a different variable type but I still set it equal to a new (whatever the class is) with the class being different than the data type. - so here I have the data type object but setting it equal to new Cube. how does it work when u do something like this. does the variable still use the methods and properties in cube because it is set as new cube or not because the datatype is object?
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

✅ Question about partial classes
C#CC# / help
2y ago
❔ Very easy question, about classes
C#CC# / help
3y ago
✅ confused about classes
C#CC# / help
3y ago
Beginner question: classes and constructor code?
C#CC# / help
2y ago