mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-14 10:45:06 +02:00
C#: edited example code according to Microsoft's naming conventions
This commit is contained in:
@@ -450,29 +450,29 @@ namespace Learning
|
|||||||
|
|
||||||
// Method declaration syntax:
|
// Method declaration syntax:
|
||||||
// <scope> <return type> <method name>(<args>)
|
// <scope> <return type> <method name>(<args>)
|
||||||
public int getCadence()
|
public int GetCadence()
|
||||||
{
|
{
|
||||||
return cadence;
|
return cadence;
|
||||||
}
|
}
|
||||||
|
|
||||||
// void methods require no return statement
|
// void methods require no return statement
|
||||||
public void setCadence(int newValue)
|
public void SetCadence(int newValue)
|
||||||
{
|
{
|
||||||
cadence = newValue;
|
cadence = newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// virtual keyword indicates this method can be overridden
|
// virtual keyword indicates this method can be overridden
|
||||||
public virtual void setGear(int newValue)
|
public virtual void SetGear(int newValue)
|
||||||
{
|
{
|
||||||
gear = newValue;
|
gear = newValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void speedUp(int increment)
|
public void SpeedUp(int increment)
|
||||||
{
|
{
|
||||||
_speed += increment;
|
_speed += increment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void slowDown(int decrement)
|
public void SlowDown(int decrement)
|
||||||
{
|
{
|
||||||
_speed -= decrement;
|
_speed -= decrement;
|
||||||
}
|
}
|
||||||
@@ -521,7 +521,7 @@ namespace Learning
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void setGear(int gear)
|
public override void SetGear(int gear)
|
||||||
{
|
{
|
||||||
gear = 0;
|
gear = 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user