bundle Default { class Thingy { @id : Int; New(id : Int) { @id := id; } method : public : Print() ~ Nil { @id->PrintLine(); } } class Person from Thingy { @name : String; New(id : Int, name : String) { Parent(id); @name := name; } method : public : Print() ~ Nil { @id->PrintLine(); @name->PrintLine(); } } class Serial { function : Main(args : String[]) ~ Nil { t := Thingy->New(7); p := Person->New(13, "Bush"); s := IO.Serializer->New(); s->Write(t->As(Base)); s->Write(p->As(Base)); writer := IO.FileWriter->New("objects.dat"); writer->WriteBuffer(s->Serialize()); writer->Close(); buffer := IO.FileReader->ReadBinaryFile("objects.dat"); d := IO.Deserializer->New(buffer); t2 := d->ReadObject()->As(Thingy); t2->Print(); p2 := d->ReadObject()->As(Person); p2->Print(); } } }