100Microsoft Visual Studio 2010: A Beginner’s Guide

public decimal CurrentBalance { get; set; }

}

}

VB:

Public Class Saving

Implements IAccount

Public Sub Credit(ByVal amount As Decimal) Implements IAccount. Credit

'Implement Saving logic CurrentBalance += amount

Console.Writeline("Added " & amount.ToString() &

"to Saving Account")

End Sub

Public Sub Debit(ByVal amount As Decimal) Implements IAccount.Debit

'Implement Saving logic CurrentBalance -= amount

Console.Writeline("Debited " + amount.ToString() +

"from Saving Account")

End Sub

Public Property CurrentBalance As Decimal

Implements IAccount.CurrentBalance

End Class

In both Listings 4-3 and 4-4, notice that the Checking and Saving, respectively, implement the IAccount interface, repeated as follows:

C#:

class Checking : IAccount

and

class Saving : IAccount

VB:

Public Class Checking

Implements IAccount

and

Public Class Saving Implements IAccount

Page 123
Image 123
Microsoft 9GD00001 manual Microsoft Visual Studio 2010 a Beginner’s Guide