Chapter 2. Objects and Visual Basic
WHAT YOU WILL LEARN IN THIS CHAPTER
Object Oriented Terminology
Composition of an Object
Characteristics of Value Types versus Reference Types
Primitive Types
Commands: If Then, Else, Select Case
Common Value Types (Structures)
Common Reference Types (Classes)
XML literals
Parameter passing ByVal and ByRef
Variable scope
Working with Objects
Understanding Binding
Data type conversions
Creating Classes
Event Handling
Advanced Object Oriented Programming
Using Lambdas
Visual Basic supports the four major defining concepts required for a language to be fully object-oriented:
Abstraction — Abstraction is merely the ability of a language to create "black box" code, to take a concept and create an abstract representation of that concept within a program. A
Customer
object, for instance, is an abstract representation of a real-world customer. ADataTable
object is an abstract representation of a set of data.Encapsulation — Encapsulation is the concept of a separation between interface and implementation. The idea is that you can create an interface (public methods, properties, fields, and events in a class), and, as long as that interface remains consistent, the application can interact with your objects. This remains true even when you entirely rewrite the code within a given method — thus, the interface is independent of the implementation. The publicly exposed interface becomes what is known as a contract. It is this contract that you will look to limit changes to for ...
Get Professional Visual Basic® 2010 and .NET 4 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.