/**
 * Serialization
 *
 * Demonstrates how to serialize an object.
 */

class Account
{
    public method get_balance ()
    {
        @balance
    }

    method initialize (balance)
    {
        field @balance = balance
    }
}

method main ()
{
    // create account object
    account = Account.new(100)

    // serialize account object
    data = Data.new(account)

    // deserialize account object
    account = data.get()

    // display account balance
    print(account.get_balance())
}

try {
    main()
} else {
    print(last_excp())
}