Visual Basic.NET
  Home arrow Visual Basic.NET arrow Page 4 - Polymorphism using Abstract Classes in Vis...
Iron Speed
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Download TestComplete 
Windows Web Hosting
 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
VISUAL BASIC.NET

Polymorphism using Abstract Classes in Visual Basic.NET 2005
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 14
    2007-08-01

    Table of Contents:
  • Polymorphism using Abstract Classes in Visual Basic.NET 2005
  • Life without the Abstract class in Visual Basic 2005: continued
  • Defining and implementing abstract classes in Visual Basic 2005: abstract class
  • Defining and implementing abstract classes in Visual Basic 2005: child class
  • Defining and implementing abstract classes in Visual Basic 2005: child classes continued
  • Making use of Polymorphism using abstract classes in Visual Basic 2005

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    Iron Speed
     
    ADVERTISEMENT

    Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!

    Polymorphism using Abstract Classes in Visual Basic.NET 2005 - Defining and implementing abstract classes in Visual Basic 2005: child class
    (Page 4 of 6 )

    In the previous section, a class named "Shape" is defined with "MustInherit" as it has one method declared with "MustOverride" (an abstract method).  In this section, I shall create child classes (sub classes) for the parent class (super class) "Shape."

    Let us start with the following:

    Public Class Rectangle

      Inherits Shape

     

      Public Sub New(ByVal l As Double, ByVal b As Double)

        MyBase.New(l, b)

      End Sub

     

      Public Overrides Function GetArea() As Double

        Return Me.X * Me.Y

      End Function

     

    End Class

    In the above "Rectangle" class, we have a constructor with the following statement:

        MyBase.New(l, b)

    The above statement calls the constructor of the super class; in this case, it is constructor of "Shape."  Finally, the abstract method is implemented with the same signature defined in the "Shape" class as follows:

      Public Overrides Function GetArea() As Double

        Return Me.X * Me.Y

      End Function

    Similarly, the "EquiTriangle" and "Square" can be defined as described in the next section.

    More Visual Basic.NET Articles
    More By Jagadish Chaterjee


       · Hai,This is my new article (adding to the series of object oriented programming...
       · I like the way the author explains the concept with simple examples.I would like to...
     

    VISUAL BASIC.NET ARTICLES

    - Types of Operators in Visual Basic
    - Operators
    - Understanding Custom Events using Visual Bas...
    - Polymorphism using Abstract Classes in Visua...
    - Shadowing using Shadows in Visual Basic.NET ...
    - Overloading and Overriding in Visual Basic.N...
    - More on Controlling Windows Fax Services Usi...
    - Programmatically Controlling Windows Fax Ser...
    - Focusing on Forms and Menus in Visual Basic
    - Manipulating Forms with the Windows Forms Li...
    - Basics of the Windows Forms Library
    - Forms, Controls, and Other Useful Objects
    - Implementing OOP to Develop Database Oriente...
    - Using Themes and Skins for Personalization w...
    - A Deeper Look at Personalization using Visua...




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway