Professional Visual Basic® 2010 and .NET 4
by Bill Sheldon, Billy Hollis, Jonathan Marbutt, Gastón C. Hillar, Rob Windsor, Kent Sharkey
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
Customerobject, for instance, is an abstract representation of a real-world customer. ADataTableobject 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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access