CS153/hw5/hw5programs/tc_subtyping8.oat
jmug 9224001a22 Update hw5 to a newer version.
Signed-off-by: jmug <u.g.a.mariano@gmail.com>
2025-01-24 21:10:31 -08:00

19 lines
No EOL
289 B
Text

struct A { int x }
struct B { int x ; int y }
struct C { int x ; int y ; int z }
/* C <: B B <: B */
/* ---------------------- */
/* (B) -> B <: (C) -> B */
B f(B b) {
return b;
}
void g((C) -> B f) {
return;
}
int program(int argc, string[] args) {
g(f);
return 0;
}