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 are Namespaces?
What is response redirect in c#?
What is the system namespace?
Which is better interface or abstract class in c#?
What is the C# syntax to catch any possible exception?
What is an array? Give the syntax for a single and multi-dimensional array?
Which control cannot be placed in mdi?
Can you access a hidden base class method in the derived class?
What is the role of the datareader class in ado.net connections?
While debugging a C# application can you change the value of a variable?
What is the use of getcommandlineargs() method in c#.net?
Can you explain template pattern?
Can derived classes have greater accessibility than their base types?
What is ilist c#?
Can class be protected in c#?