what design pattern can I use to create an object that implements a specific interface or multiple or any combination among the available interfaces? for Example say I have the following
interface A {
void foo();
}
interface B {
void bar();
}
interface C {
void car();
}
class Agent {
}
I want to be able to say give me object of class Agent that implements interface A?
or
I want to be able to say give me object of class Agent that implements interfaces B?
or
I want to be able to say give me object of class Agent that implements interfaces C?
or
I want to be able to say give me object of class Agent that implements interfaces A,B?
or
I want to be able to say give me object of class Agent that implements interfaces B,C?
or
I want to be able to say give me object of class Agent that implements interfaces A,C?
or
I want to be able to say give me object of class Agent that implements interfaces A,B,C?
or
In general what I am looking for is to create an object which can have the functionality from any combination of interfaces.
Aucun commentaire:
Enregistrer un commentaire