Visual Basic.NET
  Home arrow Visual Basic.NET arrow Page 6 - Practical Examples of Namespaces in VB.NET...
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  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
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

Practical Examples of Namespaces in VB.NET 2005
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 35
    2006-09-18

    Table of Contents:
  • Practical Examples of Namespaces in VB.NET 2005
  • Inheriting a class from another namespace: continued
  • Inheriting a class from a root namespace (or assembly)
  • Inheriting a class from a root namespace (or assembly) in practice
  • Inheriting a class from a root namespace (or assembly): example
  • Inheriting a class from root namespace (or assembly): example continued

  • 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
     
     
    ADVERTISEMENT


    Practical Examples of Namespaces in VB.NET 2005 - Inheriting a class from root namespace (or assembly): example continued


    (Page 6 of 6 )

    From the previous section, we have two classes with the same name "First" (but in different namespaces). Let us create one more class, "Second," as follows:

    NamespaceNamespace1
        Public Class Second
            Inherits First
            Private m_c As Integer
            Public Sub New(ByVal x As Integer, ByVal y As Integer,
    ByVal
    z As Integer)
                MyBase.New(x, y)
                m_c = z
            End Sub
            Public Property C() As Integer
                Get
                    Return m_c
                End Get
                Set(ByVal value As Integer)
                    m_c = value
                End Set
            End Property
            Public Function getSum() As Integer
                Dim s As Integer
                s = Me.A + Me.B + Me.C
                Return s
            End Function
        End Class
    EndNamespace

    The above section is the trickiest part. The class "Second" gets inherited from the class "First."  Which "First"? Is it related to the root namespace or the namespace "Namespace1"?

    First of all, the class "Second" belongs to the namespace "Namespace1." When this class gets inherited from another class, it checks whether that class exists within its own parent scope or not (in this case, it would be "Namespace1"). If it exists, it inherits from the same. This is called scope. So the above class "Second" gets inherited from the class "First" available in the namespace "Namespace1."

    If we need to inherit the class "Second" from the class "First" of the root namespace, we may need to modify the code as follows:

    NamespaceNamespace1
        Public Class Second
            Inherits SampleInheritance.First
          .
          .
          .
        End Class
    EndNamespace

    In this article, I simply wanted to explain the topics of OOPS. The sample codes given in this article are neither the best in performance nor the best in programming methodologies.

    Any feedback, suggestions, bugs, errors, improvements etc., are highly appreciated at jag_chat@yahoo.com.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · Hello guys! I am extending the series on OOPS with Visual Basic 2005 with this...
     

    VISUAL BASIC.NET ARTICLES

    - User-defined Functions using Visual Basic Ap...
    - Understanding Object Binding in VBA
    - Mastering the Message Box
    - Testing a Windows Forms Application
    - Using Visual Basic.NET Features to Code a Wi...
    - Correcting Code in a Windows Forms Applicati...
    - Write Readable Code and Comments for Windows...
    - How to Code and Test a Windows Forms Applica...
    - Adding Features to a Windows Forms Applicati...
    - How to Design a Windows Forms Application
    - LINQ to XML Programming Using Visual Basic.N...
    - Understanding Delegates using Visual Basic.N...
    - Create a Sudoku Puzzle Generator using VB.NET
    - Entity Creation and Messaging in a VB.NET Te...
    - Movement and Player Statistics in a VB.NET T...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek