C# Programming - Properties - Discussion
Discussion Forum : Properties - General Questions (Q.No. 1)
1.
A property can be declared inside a class, struct, Interface.
Discussion:
5 comments Page 1 of 1.
Ammar Shaukat said:
8 years ago
Property access modifier by default is public and you can't declare a public one in Interface.
Amit Balan said:
1 decade ago
Yes we do not need to use an access specifier with the interface members because the members of an interface are public by default.
Vanapandi said:
1 decade ago
But should not use/can't access specifier.
Kazeem said:
1 decade ago
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.
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.
Vibhuti said:
1 decade ago
Can we declare properties in interface?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers