Like Tree1Likes
  • 1 Post By nvoigt

in C#, are interfaces abstract?

This is a discussion on in C#, are interfaces abstract? within the C# Programming forums, part of the General Programming Boards category; here's one of those questions that tend to get asked at interviews. is an interface abstract? my understanding is that ...

  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,139
    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.
    Elkvis likes this.
    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, 10:23 AM
  4. Interfaces...
    By netboy in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 07-08-2002, 07:55 AM
  5. abstract vs pure abstract class
    By Kohatian 3279 in forum C++ Programming
    Replies: 2
    Last Post: 05-10-2002, 12:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21