Abstract class and interfaces
-
Hi, Can anybody tell me what the difference is between an Abstract class and an interface? I believe that both dont have any implementation and you inherit them with the following syntax: MyClass: BaseClass , correct? Thanks, JJ
Abstract classes may include some implementation and some abstract members. Interfaces may include no implementation. Neither may be directly instantiated. The potential benefit of abstract classes is that you get the advantages of base implementation where you want it, and enforced subclass implementation where it's needed. There is clear documentation of abstract classes and interfaces on MSDN[^]. Hope this helps.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
-
Hi, Can anybody tell me what the difference is between an Abstract class and an interface? I believe that both dont have any implementation and you inherit them with the following syntax: MyClass: BaseClass , correct? Thanks, JJ
The basic difference between an Abstract class and an interface is that Abstract class allows Concrete method(methods that have implementation) but interface doesn't. The second difference is in terms of inheritance. A class can inherit from only one class but can implement any number of interfaces. One more difference is that interface doesn't allow variables/constants to be declared but abstract class allows for declaration of variables and constants. ------------------------------------ To study, study and only to study
-
Hi, Can anybody tell me what the difference is between an Abstract class and an interface? I believe that both dont have any implementation and you inherit them with the following syntax: MyClass: BaseClass , correct? Thanks, JJ
Apart from the differences that the previous posters mentioned, there is the versioning aspect. Have a look at this http://blogs.wdevs.com/senthilkumar/archive/2005/02/21/2417.aspx[^]. I've tried to describe it there, it also has a link to where you can learn more. Regards Senthil _____________________________ My Blog | My Articles | WinMacro