98Microsoft Visual Studio 2010: A Beginner’s Guide
Making Classes Implement the Interface
To create a class,
Listing
C#:
using System;
using System.Collections.Generic; using System.Linq;
using System.Text;
namespace FirstProgram
{
class Checking : IAccount
{
public void Credit(decimal amount)
{
//implement checking logic CurrentBalance += amount; Console.Writeline("Added " + amount.ToString() +
"to Checking Account");
}
public void Debit(decimal amount)
{
//implement checking logic CurrentBalance
"from Checking Account");
}
public decimal CurrentBalance { get; set; }
}
}
VB:
Public Class Checking
Implements IAccount
Public Sub Credit(ByVal amount As Decimal) Implements IAccount. Credit