csharp-3/nested-object-initialization/BankAccount.cs - Class BankAccount and class Person. | Lecture 5 - slide 10 : 29 Program 8 |
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; } }