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?
One class can implement only one interface.
In a program if one class implements an interface then no other class in the same program can implement this interface.
From two base interfaces a new interface cannot be inherited.
Properties can be declared inside an interface.
Interfaces cannot be inherited.
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
5 comments Page 1 of 1.

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);
}

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.

BigC said:   1 decade ago
Interfaces can't be inherited either, they are implemented which is a separate concept.

Vijay kumar ray said:   9 years ago
Properties can be declared inside an interface is the right answer.

Kamal Pradhan said:   9 years ago
Properties, Methods and Events can be declared in an interface.

Post your comments here:

Your comments will be displayed after verification.