I know this is simple, but I just can’t figure it out. I’m creating a Class, My functions is what giving me the problem. I’m using O’Reilly’s C# 3.0 as a reference.
I created a class:
class Runner
{
public double miles = 0;
public double RunMiles
{
get { return miles; }
set
{
if ((value > 2)&&(value <7))
{
this.miles = value;
}
}
}
public void StartRun ()
{
// here, I want to enable the runner to start running, Make him start running//if that makes any sense.
}
public void VerifyMiles ()
{
// enter code here//I want to verify the miles are set.
}
}
For OP’s comments, some rudimentary stuffs.
To start running you should do something like this:
and to verify miles,
This is how you basically do stuff in OOP