How does VB.NET/C# achieve polymorphism?
Answer Posted / deep
Polymorphism is also achieved through interfaces. Like abstract classes, interfaces also describe the methods that a class needs to implement. The difference between abstract classes and interfaces is that abstract classes always act as a base class of the related classes in the class hierarchy. For example, consider a hierarchy-car and truck classes derived from four-wheeler class; the classes two-wheeler and four-wheeler derived from an abstract class vehicle. So, the class 'vehicle' is the base class in the class hierarchy. On the other hand dissimilar classes can implement one interface. For example, there is an interface that compares two objects. This interface can be implemented by the classes like box, person and string, which are unrelated to each other.
C# allows multiple interface inheritance. It means that a class can implement more than one interface. The methods declared in an interface are implicitly abstract. If a class implements an interface, it becomes mandatory for the class to override all the methods declared in the interface, otherwise the derived class would become abstract.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Explain MVC model binders?
What is asp.net futures?
To redirect the user to another page which method do we use without performing a round trip to the client?
To wrap up a call to a Web service the standard used is..?
What is state management in asp.net with example?
Will the asp.net validators run in server side or client side? How do you do client-side validation in .net? How to disable validator control by client side javascript?
WSDL means?
Explain the difference between singleton and single call?
Why is an object pool required?
there is two functions function a and function b like fun a(){.... ..... } fun b() { } in function b i write the coding to add two numbers and i need to dispaly the sum result in function a with out using global variable. how we do?
What is postback pixel?
What is the function of the ViewState property?
What are the merits and demerits of viewstate?
What is the difference between an htmlinputcheckbox control and an htmlinputradiobutton control?
What is bound controls