August Karlstrom
2017-09-07 11:04:17 UTC
Let's consider the following example:
MODULE test;
IMPORT Out;
TYPE
Animal = RECORD END;
Cat = RECORD (Animal) END;
Dog = RECORD (Animal) END;
VAR
x: Cat;
y: Dog;
PROCEDURE P(VAR x: Animal);
BEGIN
CASE x OF
Animal: Out.String("animal"); Out.Ln
| Cat: Out.String("cat"); Out.Ln
| Dog: Out.String("dog"); Out.Ln
END
END P;
BEGIN
P(x);
P(y)
END test.
What should be the output from this module?
Regards,
August
MODULE test;
IMPORT Out;
TYPE
Animal = RECORD END;
Cat = RECORD (Animal) END;
Dog = RECORD (Animal) END;
VAR
x: Cat;
y: Dog;
PROCEDURE P(VAR x: Animal);
BEGIN
CASE x OF
Animal: Out.String("animal"); Out.Ln
| Cat: Out.String("cat"); Out.Ln
| Dog: Out.String("dog"); Out.Ln
END
END P;
BEGIN
P(x);
P(y)
END test.
What should be the output from this module?
Regards,
August