C# Programming - Properties - Discussion

Discussion :: Properties - General Questions (Q.No.1)


A property can be declared inside a class, struct, Interface.

[A]. True
[B]. False

Answer: Option A


No answer description available for this question.

Vibhuti said: (Jun 28, 2013)  
Can we declare properties in interface?

Kazeem said: (Jul 9, 2013)  
Yes we can declare the properties in interface.

As interface contains the declaration of methods (i.e., Abstract methods) so we can declare a property in a interface. Later implement the property inside the class.

Vanapandi said: (Dec 2, 2013)  
But should not use/can't access specifier.

Amit Balan said: (Dec 17, 2013)  
Yes we do not need to use an access specifier with the interface members because the members of an interface are public by default.

Ammar Shaukat said: (Nov 17, 2016)  
Property access modifier by default is public and you can't declare a public one in Interface.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.