using System;
public class BankAccount{
public BankAccount(){
this.Balance = 0;
this.Owner = new Person();
}
public Person Owner {get; set;}
public decimal Balance {get; set;}
public override string ToString(){
return Owner + "'s account holds " + Balance + " kroner";
}
}
public class Person {
public string FirstName {get; set;}
public string LastName {get; set;}
public override string ToString(){
return FirstName + " " + LastName;
}
} | |
class BankAccount.
A BankAccount refers to a
Person object. This is important
for the example.
Class Person, which is used by BankAccount.
|