Visual Basic.NET 2008 > Working with Objects

Working with Objects in Visual Basic 2008

Jump to Table of Contents

This chapter continues the discussion of object-oriented programming (OOP) and covers some of its more-advanced, but truly useful, concepts: inheritance and polymorphism. Instead of jumping to the topic of inheritance, I’ll start with a quick overview of what you learned in the previous chapter and how to apply this knowledge.

Inheritance is discussed later in this chapter, along with polymorphism, another powerful OOP technique, and interfaces. But first make sure that you understand the basics of OOP because things aren’t always as simple as they look (but are quite often simpler than you think). In this chapter, you’ll learn how to:

Extend existing classes using inheritance - Inheritance, which is the true power behind OOP, allows you to create new classes that encapsulate the functionality of existing classes without editing their code. To inherit from an existing class, use the Inherits statement, which brings the entire class into your class.

Develop flexible classes using polymorphism - Polymorphism is the ability to write members that are common to a number of classes but behave differently, depending on the specific class to which they apply. Polymorphism is a great way of abstracting implementation details and delegating the implementation of methods with very specific functionality to the derived classes.

Issues in Object-Oriented Programming

Building classes and using themin your code is fairly simple, but there are a few points about Object-Oriented Programming (OOP) that can cause confusion. To help you make the most of Object-Oriented Programming and get up to speed, I’m including a list of related topics that are known to cause confusion to programmers— and not only beginners. If you understand the topics of the following paragraphs and how they relate to the topics discussed in the previous chapter "Building Custom Classes in VB.NET", you’re more than familiar with the principles of OOP and you can apply them to your projects immediately.

Get Started >>

Table of Contents

  1. Working with Objects
  2. Classes versus Objects
  3. Objects versus Object Variables
  4. Properties versus Fields
  5. Shared versus Instance Members
  6. Type Casting
  7. Early versus Late Binding
  8. Discovering a Variable's Type
  9. Inheritance - How to Apply Inheritance
  10. Polymorphism
  11. Advantages of Implementing Polymorphism
  12. Who Can Inherit What?
  13. The MyBase and MyClass keywords
  14. The Class Diagram Designer Copyright 2011 All Rights Reserved
  Home | Useful links | Contact us | Privacy Policy