Name

Inherits Statement

Syntax

Inheritsclassname
classname

Use: required

Type: 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

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 inheritance only. That is, there can be only a single Inherits statement in any class module.

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.)

See Also

Class Statement

Get VB .NET Language in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.