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 is polymorphism and its types in c#?

840


What are the different types of assembly?

984


What are the principles of delegation?

891


What is the difference between firstordefault and singleordefault?

846


What is the difference between Decorator and Adapter pattern?

907


1. Describe page life cycle?

2047


What is a web service in c#?

1033


Are enums static c#?

914


Is null empty or whitespace c#?

904


What is Implementation inheritance and interface inheritance?

929


What is list collection in c#?

912


Is functional interface runnable?

843


What is an xsd file?

878


What is a verbatim string literal and why do we use it?

894


What are access modifiers used for?

1022