Lecture overview -- Keyboard shortcut: 'u'  Previous page: Virtual methods in C# -- Keyboard shortcut: 'p'  Next page: Overriding the Equals method in a class -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Alphabetic index  Help page about these notes  Course home    Specialization, Extension, and Inheritance - slide 36 : 40

Practical use of virtual methods in C#
A client of different types of bank account classes illustrates a typical use of virtual methods
account-client.cs
Use of virtual bank account methods.
account-client.cs
Adding interests without use of dynamic binding - AddInterest is not virtual.
output
Output from the bank account programs.
The use of virtual methods - and dynamic binding - covers a lot of type dispatching which in naive programs are expressed with if-else chains