WHAT IS THE EXACT USE OF INTERFACE(DONT TELL USE FOR
MULTIPLE INHERITANCE)
Answer Posted / arvind nagar
Interface is mainly use to apply restrictions in accesing
the members.
For eg.-
using System;
Interface Sales
{
Void prediction();
}
Interface Hr
{
Void SalayInfo();
}
Class Abc:Sales,Hr
{
Public void Pediction()
{
x.WriteLine("Sales for 2008 will 2000 laptops");
}
Public void SalryInfo()
{
x.WriteLine("Salary is going to increment by 30%");
}
Public void Hello()
{
x.WriteLine("Hello frnds");
}
}
class test
{
public static void main()
{
Hr a= new Abc();
a.SalaryInfo();
}
}
O/p-- Salary is going to increment by 30%.
Suppose we wish to access the Hello() function, then we
can't access the a.Hello();--it gives error.
b'coz Hr doesn't contain a
definition of Hello.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What does console readkey do in c#?
List down the differences between “dispose” and “finalize” methods in c#.
Why should you override the tostring() method?
What does clr stand for?
Can we override main method in c#?
What is parameterized constructor?
What is readline c#?
how dot net compiled code will become platform independent?
What does console mean c#?
Is c# and c same?
What is dll file in c#?
What is dependency injection in simple words?
What is Event - Delegate?
Is xamarin free?
Is null or empty in c#?