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 the advantages of caching?
Why mvc is better than asp.net? : Asp.Net MVC
What is a query string in a url?
Define reflection in .net?
Can you clarified A Web service can only be written in .NET or not?
Explain the difference between authentication and authorization.
Differentiate between early binding and late binding.
What is a response cookie?
if i wanna deploy my asp.net project to the production server and situation is that i m still not compiled my project i have as-is on my development side now on production server we dont have a visual studio now what kind of settings i need to be to do in webconfig /machine.config file to deploy my project and in iis too....
What do you mean by marshalbyref?
What is css in asp.net?
What is difference between abstract class and an interface?
To add a hyperlink column to the DataGrid which tag is used ?
What is repository pattern in mvc.net? : asp.net mvc
What is asp according to you?