I'm writing a Java application, and have a question. How can I implement a function with one parameter which should require an argument which implements multiple interfaces? For example:
interface Father
{
}
interface Teacher
{
}
public void foo(FatherAndTeacher person) // How do I do this?
{
// Do something
}
I know I can use two parameters, such as:
public void foo(Father person1, Teacher person2)
{
// Do something
}
but I think maybe having a single parameter which implements both interfaces would be better.
I'm writing a Java application, and have a question. How can I implement a function with one parameter which should require an argument which implements multiple interfaces? For example:
interface Father
{
}
interface Teacher
{
}
public void foo(FatherAndTeacher person)
{
// Do something
}
I know I can use two parameters, such as:
public void foo(Father person1, Teacher person2)
{
// Do something
}
but I think maybe having a single parameter which implements both interfaces would be better.
I'm writing a Java application, and have a question. How can I implement a function with one parameter which should require an argument which implements multiple interfaces? For example:
interface Father
{
}
interface Teacher
{
}
public void foo(FatherAndTeacher person) // How do I do this?
{
// Do something
}
I know I can use two parameters, such as:
public void foo(Father person1, Teacher person2)
{
// Do something
}
but I think maybe having a single parameter which implements both interfaces would be better.
About Java method & a parameter which implements multiple interfaceinterfaces
I'm writing a javaJava application, and findhave a question ,if my function's. How can I implement a function with one parameter needwhich should require an argument which implements multiple interface, such as I have two interface--[father_Inf, teacher_Inf](a people who is a father and a teacher), and I need both of them as my function's one parameter(such as void Do(father_Inf&teacher_Inf human)).interfaces? For example:
interface Father
{
}
interface Teacher
{
}
public void foo(FatherAndTeacher person)
{
// Do something
}
I know I can use tow parametertwo parameters, such as:
public void foo(Father person1, Teacher person2)
{
// Do something
}
but I think maybe havehaving a way let onesingle parameter implement both interface, and can't google or baidu the right answer(most because I can't description clear, and which gets most no use), can who help me?Thanks very much! &Sorry about my Chinese Englishimplements both interfaces would be better.
About Java method & a parameter implements multiple interface
I'm writing a java application, and find a question ,if my function's one parameter need implements multiple interface, such as I have two interface--[father_Inf, teacher_Inf](a people who is a father and a teacher), and I need both of them as my function's one parameter(such as void Do(father_Inf&teacher_Inf human)). I know I can use tow parameter, but I think maybe have a way let one parameter implement both interface, and can't google or baidu the right answer(most because I can't description clear, and which gets most no use), can who help me?Thanks very much! &Sorry about my Chinese English.
About Java method & a parameter which implements multiple interfaces
I'm writing a Java application, and have a question. How can I implement a function with one parameter which should require an argument which implements multiple interfaces? For example:
interface Father
{
}
interface Teacher
{
}
public void foo(FatherAndTeacher person)
{
// Do something
}
I know I can use two parameters, such as:
public void foo(Father person1, Teacher person2)
{
// Do something
}
but I think maybe having a single parameter which implements both interfaces would be better.
About Java method & a parameter implements multiple interface
I'm writing a java application, and find a question ,if my function's one parameter need implements multiple interface, such as I have two interface--[father_Inf, teacher_Inf](a people who is a father and a teacher), and I need both of them as my function's one parameter(such as void Do(father_Inf&teacher_Inf human)). I know I can use tow parameter, but I think maybe have a way let one parameter implement both interface, and can't google or baidu the right answer(most because I can't description clear, and which gets most no use), can who help me?Thanks very much! &Sorry about my Chinese English.