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. C# interfaces doesn't contain data members

C# interfaces doesn't contain data members

Scheduled Pinned Locked Moved C#
csharpquestion
3 Posts 3 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.
  • D Offline
    D Offline
    DGtech
    wrote on last edited by
    #1

    why C# interfaces doesn't contain data members?

    P C 2 Replies Last reply
    0
    • D DGtech

      why C# interfaces doesn't contain data members?

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      Because it doesn't actually implement anything. It only provides a contract that states what methods/properties will be present.

      Deja View - the feeling that you've seen this post before.

      1 Reply Last reply
      0
      • D DGtech

        why C# interfaces doesn't contain data members?

        C Offline
        C Offline
        Colin Angus Mackay
        wrote on last edited by
        #3

        Because that is not the purpose of an interface. An interface defines the public interface* of a class (or part of a class) that implements the interface. If you want data members then you should look at implementing an abstract class. * Note there is a difference between interface and interface


        Upcoming events: * Edinburgh: Web Security Conference Day for Windows Developers (12th April) * Glasgow: AJAX, SQL Server, Mock Objects My: Website | Blog | Photos

        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