![]() ![]() ![]() | Lecture 7 - slide 27 : 41 |
class A {
int v = 5;
}
class B extends A {
int w = 6;
}
class StaticDynamicTypes {
public static void main (String[] args){
A x = new A();
B y = new B();
x = y; // OK
y = x; // Problemer. Kan ikke oversættes.
y = (B)x; // OK med cast
}
}