Interface members can not be declared as

A) Virtual
B) Static
C) Private
D) All of the above

Showing Answers 1 - 12 of 12 Answers

Jyoshna

  • Jan 3rd, 2006
 

 answer is Private

becoz there is no meaning in declaring interface methods as private.

As interface methods are implemented in inherited classes only.

  Was this answer useful?  Yes

hari charagundla

  • Jan 4th, 2006
 

Answer is DBecause Interface can not have the access specifiers for its members.

  Was this answer useful?  Yes

samiksc

  • Jan 9th, 2006
 

D is the correct choice

Virtual keyword is meaningful when the derived class is expected to override base class method. Here a class will 'implement' a method of an interface, hence virtual is not meaningful for interface methods.

Static keyword indicates that a method or field is common to all instances of a class. For an interface there will not be any instance, hence static is not meaningful.

An interface and all its methods must be declared public for enabling classes to implement them.

Don

  • Jan 20th, 2006
 

Answer is all of the above.

we cannot have either static, virtal or private before the method name inside an interface.

  Was this answer useful?  Yes

Emma

  • Feb 9th, 2006
 

interface-modifier:
     new
     public
     protected
     internal
     private

the above are valid interface access modifiers, however some are only allowed in certain circumstances. Check out C# spec or Anders book on C# (see below).

So the answer is "the question is incomplete or vague"  

C# Programming Language, The
By Anders Hejlsberg, Scott Wiltamuth, Peter Golde
...............................................
Publisher: Addison Wesley Professional
Pub Date: October 30, 2003
Print ISBN-10: 0-321-15491-6

 

  Was this answer useful?  Yes

bulldog

  • Mar 4th, 2006
 

All interface members implicitly have public access. It is a compile-time error for interface member declarations to include any modifiers. In particular, interfaces members cannot be declared with the modifiers abstract, public, protected, internal, private, virtual, override, or static.

You decide.

  Was this answer useful?  Yes

bulldog

  • Mar 5th, 2006
 

All interface members implicitly have public access. It is a compile-time error for interface member declarations to include any modifiers. In particular, interfaces members cannot be declared with the modifiers abstract, public, protected, internal, private, virtual, override, or static.

You decide

  Was this answer useful?  Yes

dan

  • Mar 8th, 2006
 

Interface members are public by default. But we dont/cant specify modifiers to them so that we dont fall into the impression that thay can also be private or ..... They are public by default and we dont have to specify that!

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions