Interfaces - Features,Properties - Csharp.Net

Q.  Which of the following are correct?

1. An interface can be instantiated directly.
2. Interfaces can contain constructor.
3. Interfaces contain no implementation of methods.
4. Classes and structs can implement more than one interface.
5. An interface itself can inherit from multiple interfaces.

- Published on 31 Aug 15

a. 3,4,5
b. 1,2,3
c. 2,3,4
d. All of the above

ANSWER: 3,4,5
 
Interfaces are like classes but we cannot provide definition of methods in interface. We can only declare the methods not implementation in interface. A class must implement all its members that is inheriting the interface.
An interface has the following properties:

• An interface cannot be instantiated directly.
• Interfaces can contain events, indexers, methods and properties.
• Interfaces contain no implementation of methods.
• Classes and structs can inherit from more than one interface.
• An interface can itself inherit from multiple interfaces.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)