Add all the assignment code.
Signed-off-by: jmug <u.g.a.mariano@gmail.com>
This commit is contained in:
parent
58c6b1f81c
commit
cfe502c598
1277 changed files with 48709 additions and 1 deletions
20
hw6/hw5programs/tc_subtyping7.oat
Normal file
20
hw6/hw5programs/tc_subtyping7.oat
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
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;
|
||||
}
|
||||
|
||||
B g((C) -> B f) {
|
||||
var c = new C {x = 1; y = 2; z = 3};
|
||||
return f(c);
|
||||
}
|
||||
|
||||
int program(string[] args) {
|
||||
var b = g(f);
|
||||
return b.y;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue