C#: comments about "this" keyword

This commit is contained in:
Max Yankov 2013-08-17 16:06:04 +02:00
parent 4295e85d60
commit c3df13db56

View File

@ -422,10 +422,10 @@ namespace Learning
public Bicycle(int startCadence, int startSpeed, int startGear, public Bicycle(int startCadence, int startSpeed, int startGear,
string name, bool hasCardsInSpokes) string name, bool hasCardsInSpokes)
{ {
this.gear = startGear; this.gear = startGear; // "this" keyword denotes the current object
this.cadence = startCadence; this.cadence = startCadence;
this._speed = startSpeed; this._speed = startSpeed;
this.name = name; this.name = name; // it can be useful when there's a name conflict
this.hasCardsInSpokes = hasCardsInSpokes; this.hasCardsInSpokes = hasCardsInSpokes;
} }