
Chapter 4: Learning Just Enough C# and VB.NET: Intermediate Syntax | 97 |
Creating an Interface
To create an interface,
Listing 4-2 An interface
C#:
using System;
using System.Collections.Generic; using System.Linq;
using System.Text;
namespace FirstProgram
{
public interface IAccount
{
void Credit(decimal amount); void Debit(decimal amount); decimal CurrentBalance { get; set; }
}
}
VB:
Public Interface IAccount
Sub Credit(ByVal amount As Decimal)
Sub Debit(ByVal amount As Decimal)
Property CurrentBalance As Decimal
End Interface
After you’ve added the interface, you’ll need to make modifications to make the code match Listing