Problem solve Get help with specific problems with your technologies, process and projects.

Why is VB.NET considered truly object-oriented, but VB6 isn't?

Why is VB.NET considered truly object-oriented? And why was VB 6.0 not considered to be so?
VB6 is considered "object-based" because it supports classes and objects but not inheritance. Inheritance allows a class to get fields and methods from a base class, like this sample in VB.NET:

' Base class
Class Dog
  Public Sub Bark()
  End Sub
End Class

' Derived class
Class BigDog
  ' Inherit all members from base class Dog
  Inherits Dog

  ' Add new member
  Public Sub EatCat()
  End Sub
End Class

Module App
  Sub Main()
    ' Create an instance of the derived class
    Dim fido As BigDog = New BigDog()

    ' Call a method from the base class
  End Sub
End Module

Inheritance is a powerful feature of reuse, allowing you to factor shared functionality between classes into a base class, reusing them in specific derived classes. While there are other new object-oriented features new to VB.NET, inheritance, long present in languages like C++ and Java, is the key new feature in VB.NET that makes it object-oriented instead of object-based.

Dig Deeper on Win Development Resources

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.