Where would you use abstract class and interface in VB.NET?
Where would you use abstract class and interface in VB.NET? give also example!
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Andrew FensterRank #983 · 2K reputationPosted Mar 13, 2011, 6:40 AM EDT
(1) An interface has no code. It simply defines a list of public methods that any implementing class must include. An abstract class, on the other hand, can include code. That is, it can define a list of public methods, and then it can also have code to implement some or all of these. So classes that inherit from the abstract class start out with a basic set of code.
(2) Your class can inherit from only one class. However it can implement any number of interfaces.
You should devote some time to reading about abstract classes, interfaces and inheritance. A few hours of reading will do you a tremendous amount of good.
Martin van Eerde22 reputationPosted Mar 14, 2011, 3:32 AM EDT
A interface defines a contract you a class will implement. Generally interfaces should only have a small number of methods and be very specific.
As Andrew says you should do some reading, especially composition over inheritance.