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 happens during the process of boxing?
How long does it take to learn c# programming?
From a versioning perspective, what are the drawbacks of extending an interface as opposed to extending a class?
What is difference between out and ref in c#?
What is serialization in dot net?
What is an enumerator in c#?
What is lazy class in c#?
What is jit (just in time)?
Define sealed classes in c#?
Is c# different than c++?
Can we inherit a class with private constructor in c#?
What is an array? Give the syntax for a single and multi-dimensional array?
What is the main method in c#?
Please write a program to display “welcome to bestinterviewquestion.com” in c#?
What does readonly mean in c#?