Visual Basic.NET
  Home arrow Visual Basic.NET arrow 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 
IBM Rational Software Development Conference
 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

    TestComplete™ automates software testing for a fraction of what the big guys charge. Easy functional and load testing for all Windows, .NET, Java and Web apps. Download a free trial now.

    Polymorphism using Abstract Classes in Visual Basic.NET 2005
    (Page 1 of 6 )

    This article gives you an in-depth understanding of abstract methods, abstract classes and polymorphism using abstract classes in Visual Basic 2005.
    A downloadable zip file is available for this article.

    If you are new to OOP in Visual Basic.NET, I strongly suggest that you go through the following links:

    Using Constructors with Object-Oriented Database Development

    Properties and Object-Oriented Database Development

    Using Methods with Object-Oriented Database Development

    An Introduction to Object-Oriented Database Development

    The entire source code for this article is available in the form of a downloadable zip file. The solution was developed using Microsoft Visual Studio 2005 Professional Edition on Microsoft Windows Server 2003 Enterprise Edition. I didn't really test it in any other environment. I request that you post in the discussion area if you have any problems in execution.

    Life without the "Abstract" class in Visual Basic 2005

    Before understanding the "Abstract" class, let us go through an example with a set of classes, which demonstrates the inconveniences of repeating the code.

    The following is a class named "Rectangle" defined with length and breadth as properties along with a method named "GetArea" to calculate the area of a rectangle:

    Public Class Rectangle

      Private _l As Double

      Private _b As Double

     

      Public Sub New(ByVal length As Double, ByVal breadth As Double)

        Me.L = length

        Me.B = breadth

      End Sub

     

      Public Property L() As Double

        Get

          Return _l

        End Get

        Set(ByVal value As Double)

          _l = value

        End Set

      End Property

     

      Public Property B() As Double

        Get

          Return _b

        End Get

        Set(ByVal value As Double)

          _b = value

        End Set

      End Property

     

      Public Function GetArea() As Double

        Return _l * _b

      End Function

     

    End Class

    There exists nothing special about the previous class apart from properties, methods and a constructor.  Let us consider two more classes, "EquiTriangle" and "Square," which have properties that are similar to those of our "Rectangle" class. This will be continued 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...

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




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