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
Can you pass parameters to destructors?
Explain the accessibility modifier protected internal?
What are custom exceptions in C#?
What are primitive types in c#?
Can we have static indexer in c#?
Is unity object oriented?
How to add controls dynamically to the form using c#.net.
What do you mean by abstract class in c#?
What are the differences between a class and a struct?
What is the difference between ref and out in c#?
Write a program to find the angle between the hours and minutes in a clock
What is the data provider name to connect to access database?
What is value c#?
Explain use of abstract and sealed classes in c#?
What is COM Interoperability?