OK so a quick interface tutorial!
im not at home though so the code will be untested!
An interface is just a definition of a "contract" i.e. it allows the creator of an interface to define a contract that consumers of the interface must adhear to. now the beauty of an interface is that it doesnt care about the underlying types. As long as an object implements the interface, you can interact with that object without caring what type the object actually is.
Example
I have a load of different vehicle types and they can all be started so i define an iStartable interface. The interface has a start method defined that returns true or false
interface iStartable
{
bool Start();
}
I can now implement this with different types of vehicles
class Car : iStartable
{
public bool Start()
{
debug.writeline("Car Started");
}
}
class Truck : iStartable
{
public bool Start()
{
debug.writeline("Truck Started");
}
}
the good thing is i dont need to worry about their concrete type so for example i can do the following
arraylist myList = new arrayList();
myList.Add (new car());
mylist.Add(new Truck());
foreach(iStartable startable in myList)
{
startable.Start();
}
I would really like to get in this league if possible,
I have been away from lfs for about 2 years and before that played for about 4 months so would consider myself a beginner! however I dont have the points required on the CTRA server.
Will I be able to register? I will try and amass the points before the season starts!