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
What is polymorphism and its types in c#?
What are the different types of assembly?
What are the principles of delegation?
What is the difference between firstordefault and singleordefault?
What is the difference between Decorator and Adapter pattern?
1. Describe page life cycle?
What is a web service in c#?
Are enums static c#?
Is null empty or whitespace c#?
What is Implementation inheritance and interface inheritance?
What is list collection in c#?
Is functional interface runnable?
What is an xsd file?
What is a verbatim string literal and why do we use it?
What are access modifiers used for?