I am a Web Developer in aps.net technology .Presently working in G-Asra Tech Ludhiana(Punjab), India
class Demo
{
public static void Main()
System.Console.WriteLine("Hello Interfaces");
}
interface abc
Hello Interfaces
Demo
Main()
abc
int x;
P2.cs(11,3): error CS0525: Interfaces cannot contain fields
x
void xyz()
System.Console.WriteLine("In xyz");
P3.cs(11,8): error CS0531: 'abc.xyz()': interface members cannot have a
definition
xyz()
void xyz();
class Demo : abc
P4.cs(1,7): error CS0535: 'Demo' does not implement interface member
'abc.xyz()'
P4.cs(11,8): (Location of symbol related to previous error)
demo : abc
xyz
a.cs(1,7): error CS0536: 'Demo' does not implement interface member
'abc.xyz()'.'Demo.xyz()' is either static, not public,
or has the wrong return type.
a.cs(16,8): (Location of symbol related to previous error)
a.cs(7,8): (Location of symbol related to previous error)
xyz();
public void xyz()
In xyz
Sample
Demo refDemo = new Demo();
refDemo.xyz();
Sample refSample = new Sample();
refSample.xyz();
System.Console.WriteLine("In Demo :: xyz");
class Sample : abc
System.Console.WriteLine("In Sample :: xyz");
In Demo :: xyz
In Sample :: xyz
refDemo
refSample
abc refabc = new Demo();
refabc.xyz();
abc refabc = new Sample();
refabc
abc [] refabc = {new Demo(), new Sample()} ;
for (int i = 0; i<= 1; i++)
refabc[i].xyz();
class Demo : abc, def
public void pqr()
interface def
void pqr();
def
pqr()
ref abc
No comments:
Post a Comment