Z
zoe
My compiler (JBuilder3) does not accept the code below.
But i can't find this te be illegal in the jaca spec.
Can anyone help?
public class MyClass1 {
public static void main(String[] args) {
DC dc= new DC();
Sub b=new Sub();
dc.g(b);
}
}
class BC{
void g(Sub d){}
}
class DC extends BC{
void g(Sup b){}
}
class Sup{}
class Sub extends Sup{}
How does de code above differ from:
class Test{
void foo(Sup b){}
void foo(Sub d){} //overloading
}
Test t=new Test();
t.foo(new Sub());
regards,
Zoe
But i can't find this te be illegal in the jaca spec.
Can anyone help?
public class MyClass1 {
public static void main(String[] args) {
DC dc= new DC();
Sub b=new Sub();
dc.g(b);
}
}
class BC{
void g(Sub d){}
}
class DC extends BC{
void g(Sup b){}
}
class Sup{}
class Sub extends Sup{}
How does de code above differ from:
class Test{
void foo(Sup b){}
void foo(Sub d){} //overloading
}
Test t=new Test();
t.foo(new Sub());
regards,
Zoe