© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
41 replies
McMahone

❔ initiating Constructor

Why cant I sometimes initiate data members in a constructor like this:

Public Car (int wheels, string color)
{
Wheels = wheels
Color = color
}

And only use
this.color = color
this.wheels = wheels

What is the difference? Why do we have use this at all?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

Primary Constructor
C#CC# / help
5mo ago
❔ empty constructor
C#CC# / help
3y ago
Converting the simple constructor to primary constructor
C#CC# / help
3y ago