© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
8 replies
dusk

❔ accessing object from a class inside of another class

I got this class called "Engine"(image 1) that has the object "isOn" which indicates whether the engine is on or off. I got another class called "Car"(image 2) which consists of several objects as well as on object of type Engine;

I'm trying to create a method in class Car that gives me the engine's isOn.
I don't know how to refer to it. this is how I tried to do this(image 3) but it doesn't work.
image.png
image.png
image.png
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

❔ Accessing variable from another class
C#CC# / help
3y ago
accessing an instance of a class in another class
C#CC# / help
3y ago
Accessing data from another project
C#CC# / help
4y ago