c# error cs0103 code example
Example 1: c# warning CS0108
//warning CS0108
class Bicycle : Vehicle //Subclass
{
public override void SpeedUp() //Add 'override'
{
Speed += 5;
}
}
//error CS0506
class Vehicle //Superclass
{
public virtual void SpeedUp() //Add 'virtual'
{
Speed += 5;
}
}
Example 2: c# error CS0200
/* Sedan.cs(41,5): error CS0200: Property or indexer
'Sedan.Speed' cannot be assigned to -- it is read only */
public void SpeedUp()
{
Speed += 5;
} //Trying to change/set value
public double Speed
{ get; } //Property speed doesn't have setter
public double Speed
{ get; set; } //Fixes error