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

Can you pass parameters to destructors?

1006


Explain the accessibility modifier protected internal?

819


What are custom exceptions in C#?

992


What are primitive types in c#?

938


Can we have static indexer in c#?

863


Is unity object oriented?

872


How to add controls dynamically to the form using c#.net.

862


What do you mean by abstract class in c#?

924


What are the differences between a class and a struct?

1033


What is the difference between ref and out in c#?

865


Write a program to find the angle between the hours and minutes in a clock

890


What is the data provider name to connect to access database?

945


What is value c#?

798


Explain use of abstract and sealed classes in c#?

822


What is COM Interoperability?

920