newbie interface

  • Thread starter Thread starter cEciLle
  • Start date Start date
I'm not sure if this is what you are asking but do you mean like this:

interface IMyInterface
{
void DoSomething();
string SomeProperty
{
get;
set;
}
}

class Class1 : IMyInterface
{
public void DoSomething()
{
// Do Something
}

private string someProperty = "I'm some property!";
public string SomeProperty
{
get
{
return someProperty;
}

set
{
someProperty = value;
}
}
}


class Class2 : Class1
{
// Class2
}
 
It is something like this.

Interface 1 inherits class1

class2 have method1, method2 and public method 3 but class2 inherits class1.

will my program look like this

Interface interface1
{
method1();
method2();
}

class1 :interface1
{
method1();
method2();
}

class2:class1
{
method1();
method2();
public method3();
}

thanks
 
Hi cEciLle,

I am not sure if you have seen "Brian Delahunty"'s reply. I think he has
provided you a little sample. Yes, the key point is that we must implement
the interface's properties and methods, in class1. Then in class2, we can
do anything we like just like normal inheritance.

Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top