Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

growing explicit interface implementation declaration!!! 1

Status
Not open for further replies.

ajikoe

Programmer
Apr 16, 2004
71
0
0
ID
I have three interface like this:
interface IStorable{
void read();
}
interface ITalk{
void talk();
}
interface IRun{
void run
}

I have 3 class (Document, Note, NoteRun) which the first class is the second base clase, the second class is the third base class. All the methods in class 1 is writen in explicit interface implementation.

public class Document:IStorable,ITalk{
//Constructor...
void IStorable.read{
//something;
}

void ITalk.talk{
//something;
}
}

public class Note:Document,IStorable,ITalk{
//Constructor...
void IStorable.read{
//something;
}

void ITalk.talk{
//something;
}
}

public class NoteRun:Note, IStorable,ITalk,IRun{
//Constructor...
void IStorable.read{
//something;
}
void ITalk.talk{
//something;
}

void IRun.run{
//something;
}
}

Now I just curious is there any other way to avoid these growing declaration:

public class Document:IStorable,ITalk
public class Note:Document,IStorable,ITalk
public class NoteRun:Note, IStorable,ITalk,IRun

Everytime I make new derived class, I have to write down all of the interface.......?

I just wonder the negatif effect of this explicit interface implementation declaration..

Sincerely Yours,
Pujo

 
That's pretty much the way it works. I've seen classes that implement 10 or more interfaces, plus inherit from a base class. I wouldn't worry about it.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top