A
anon
How can I do the following....
interface iface
{
int someMethod();
}
class c1 : iface
{
int someMethod() {return 10;}
}
class c2 : iface
{
int someMethod() {return {return 20;}
}
class Test
{
int testMethod()
{
return testInterface(new c1());
}
int testInterface(iface i)
{
// in this case, returns 10
// as it stands now, i have to
// cast it to a c1, before it will
// return correct value;
return i.testMethod
}
}
Thanks
interface iface
{
int someMethod();
}
class c1 : iface
{
int someMethod() {return 10;}
}
class c2 : iface
{
int someMethod() {return {return 20;}
}
class Test
{
int testMethod()
{
return testInterface(new c1());
}
int testInterface(iface i)
{
// in this case, returns 10
// as it stands now, i have to
// cast it to a c1, before it will
// return correct value;
return i.testMethod
}
}
Thanks