Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is Interface? Explain with an example.

Answer Posted / dharmendra kumar

Interface is a syntactical contract that all the derived
classes should follow.

public interface MotorStateObject
{
int State{ get;}

void Running();

void Stop();

int Speed { set;get; }

}
public class Car : MotorStateObject
{ .....
}

public class Bike : MotorStateObject
{......
}

public class Bus : MotorStateObject
{......
}

public class MotorState()
{
public void applybrake(MotorStateObject Object)

{
MotorStateObject.Stop();
}
}

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What happens during the process of boxing?

1061


How long does it take to learn c# programming?

912


From a versioning perspective, what are the drawbacks of extending an interface as opposed to extending a class?

962


What is difference between out and ref in c#?

1000


What is serialization in dot net?

954


What is an enumerator in c#?

972


What is lazy class in c#?

870


What is jit (just in time)?

981


Define sealed classes in c#?

922


Is c# different than c++?

893


Can we inherit a class with private constructor in c#?

1049


What is an array? Give the syntax for a single and multi-dimensional array?

911


What is the main method in c#?

1081


Please write a program to display “welcome to bestinterviewquestion.com” in c#?

918


What does readonly mean in c#?

998