C# Programming - Interfaces - Discussion
Discussion Forum : Interfaces - General Questions (Q.No. 4)
4.
Which of the following statements is correct about an interface used in C#.NET?
Discussion:
5 comments Page 1 of 1.
Kamal Pradhan said:
9 years ago
Properties, Methods and Events can be declared in an interface.
Vijay kumar ray said:
9 years ago
Properties can be declared inside an interface is the right answer.
IVy said:
1 decade ago
Interfaces can be inherited :
interface IShape
{
void Show();
}
interface ITwoDShape : IShape
{
double Perimeter
{
get;
}
double Area
{
get;
}
}
interface IThreeDShape : IShape
{
double Volume
{
get;
}
}
interface IComparable
{
int CompareTo(Object obj);
}
interface IShape
{
void Show();
}
interface ITwoDShape : IShape
{
double Perimeter
{
get;
}
double Area
{
get;
}
}
interface IThreeDShape : IShape
{
double Volume
{
get;
}
}
interface IComparable
{
int CompareTo(Object obj);
}
BigC said:
1 decade ago
Interfaces can't be inherited either, they are implemented which is a separate concept.
Venkatesh Bojja said:
1 decade ago
public interface ISampleInterface
{
// Property declaration:
string Name
{
get;
set;
}
}
Properties can be used inside an interface. In the above example the accessor of an interface property does not have a body. Thus, the purpose of the accessors is to indicate whether the property is read-write, read-only, or write-only.
{
// Property declaration:
string Name
{
get;
set;
}
}
Properties can be used inside an interface. In the above example the accessor of an interface property does not have a body. Thus, the purpose of the accessors is to indicate whether the property is read-write, read-only, or write-only.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers