Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Abstract class and interfaces

Abstract class and interfaces

Scheduled Pinned Locked Moved C#
question
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MrJJKoolJ
    wrote on last edited by
    #1

    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

    T _ S 3 Replies Last reply
    0
    • M MrJJKoolJ

      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

      T Offline
      T Offline
      turbochimp
      wrote on last edited by
      #2

      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...’

      1 Reply Last reply
      0
      • M MrJJKoolJ

        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

        _ Offline
        _ Offline
        _J_
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • M MrJJKoolJ

          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

          S Offline
          S Offline
          S Senthil Kumar
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups