Thread: in C#, are interfaces abstract?

  1. #1
    Registered User
    Join Date
    Sep 2011
    Posts
    71

    in C#, are interfaces abstract?

    here's one of those questions that tend to get asked at interviews.

    is an interface abstract?


    my understanding is that in some languages an interface is considered abstract, and it is considered abstract in the sense that its members lack implementation and because it cannot be instantiated directly.

    since its members lack implementation these members are said to be 'abstract'.

    abstract classes, on the other hand, also can't be instantiated directly but in addition to abstract members, which unlike interface members are declared with the keyword 'abstract', they can also have concrete members.

    anyway, i've been asked the question of whether an interface is abstract and this question always felt like it's one of those questions that no matter what you answer your answer is wrong.

    if i answer that an interface is abstract then i'm 'guilty' of assuming that the fact that its members lack implementation makes the interface 'abstract', since there is more to 'abstractness' than having members with no implementation.

    if I say that it is not abstract then I'm 'guilty' of assuming that because neither an interface nor its members are declared using the keyword 'abstract', they cannot possibly be implicitly abstract and therefore abstract.

    what's the proper way to answer this question if you don't want to sound like an idiot the next time you get this question during an interview?
    Last edited by y99q; 11-22-2011 at 10:20 PM.

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    Why not tell your interviewer what you just told us. I would do the same. It shows that you actually thought about it instead of being lucky in a 50% guess.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WinAPI interfaces in C
    By Uwar in forum Windows Programming
    Replies: 1
    Last Post: 12-10-2009, 05:48 PM
  2. New to creating interfaces
    By rpm28 in forum C++ Programming
    Replies: 1
    Last Post: 11-23-2007, 08:20 AM
  3. Graphical Interfaces
    By jer2eydevil88 in forum C++ Programming
    Replies: 5
    Last Post: 08-09-2006, 09:23 AM
  4. Interfaces...
    By netboy in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 07-08-2002, 06:55 AM
  5. abstract vs pure abstract class
    By Kohatian 3279 in forum C++ Programming
    Replies: 2
    Last Post: 05-10-2002, 11:12 AM