Hi all,
Extract from the book:
Quote:
|
Interfaces members can also be implemented on bases classes:
|
Shouldn't they say derived classes??
Code:
public interface IMyinterface
{
void DoSomething();
void DoSomethingElse();
}
public class MyBaseClass
{
public void DoSomething()
{
}
}
public class MyDerivedClass : MyBaseClass, IMyInterface
{
public void DoSomethingElse()
{
}
}
MyBaseClass doesn't implement
IMyInterface.
But
MyDerivedClass does although it doesn't contain the implementation of the
DoSomething() method (that
MyBaseClass does!!).
How come it works without having MyBaseClass implementing IMyInterface???
And why
MyDerivedClass doesn't contain a implementation for DoSomething()?? (Is it because of its Base Class?)
I tried to run the program and it does work. But yet I still don't get it!
Is anyone having the same issue??