Skip to Content
VB.NET Language in a Nutshell, Second Edition
book

VB.NET Language in a Nutshell, Second Edition

by Steven Roman PhD, Ron Petrusha, Paul Lomax
April 2002
Intermediate to advanced
688 pages
19h 51m
English
O'Reilly Media, Inc.
Content preview from VB.NET Language in a Nutshell, Second Edition

Name

Inherits Statement

Syntax

Inherits classname
classname (required; String literal)

The name of the inherited (base) class

Description

Specifies the name of the class that is being inherited, that is, the base class. The statement can appear immediately after the Class statement or the Interface statement.

Rules at a Glance

  • The Inherits statement must be the first line of code in the class module. It can be preceeded only by blank lines or comments. For example:

    Public Class CDerivedClass
       Inherits CBaseClass
       ...
  • VB.NET supports single code-based inheritance only. That is, there can be only a single Inherits statement in any class module.

  • If the Inherits statement is used to define the interfaces inherited by an interface, multiple interfaces can be listed, with a comma used to delimit them. For example:

             Interface IPerson
                Property Name As String
             End Interface
    
             Interface IEmployee
                Property SSN As String
             End Interface
    
             Interface ISalaried
                Inherits IPerson, IEmployee
    
                Property Salaried As Boolean
                Property Salary As Decimal
             End Interface

Programming Tips and Gotchas

The Inherits statement implements code inheritance. You can also use the Implements statement to implement interface inheritance. In that case, a class can be derived from more than one virtual base class. (In other words, you can effectively implement multiple inheritance through interface inheritance using the Implements statement.)

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

VB .NET Language in a Nutshell

VB .NET Language in a Nutshell

Steven Roman PhD, Ron Petrusha, Paul Lomax

Publisher Resources

ISBN: 0596003080Supplemental ContentCatalog PageErrata