Inheritance in the .NET Framework

As you saw from the moment you wrote your first example of a class, when you used the period to access a variable's members, the IntelliSense drop-down list will contain some “mysterious” members that you never declared. These members are Equals, GetHashCode, GetType, and ToString. Now you know enough to understand that these members must come from some base class. But how, because your classes did not used Inherits at that point?

The mystery is solved quite simply. All classes in the .NET Framework (and in general in all .NET languages) inherit (directly or indirectly) from a base class called Object. This inheritance is implicit; you do not need to declare it, the compiler assumes that if your class does not ...

Get Visual Basic® .NET by Example 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.