Skip to main content Accessibility help
×
Hostname: page-component-5c6d5d7d68-7tdvq Total loading time: 0 Render date: 2024-08-10T09:19:11.915Z Has data issue: false hasContentIssue false

Chapter 3 - Structures

Published online by Cambridge University Press:  06 July 2010

Michael McMillan
Affiliation:
Pulaski Technical College, Arkansas
Get access

Summary

A structure is a user-defined data type that allows a single variable to store more than one type of data. In Visual Basic 6, structures were actually called user-defined types. The structure object has been improved in VB.NET, however, because VB.NET structures can contain both data and subprocedures to operate on those data. Structures are very common in form to classes, though they have several limitations that restrict their use to solve object-oriented programming problems. Because they are similar in form to classes, structures provide an excellent introduction to the use of classes, which is why we spend an entire chapter discussing them.

USING STRUCTURES

In Chapter 2 you were introduced to the concept of the abstract data type. To implement an ADT in VB.NET, we need to use a special data type called a structure. A structure allows us to store multiple components of different data types in one logical unit. In some languages structures are known as records.

The atomic data types (Integer, Single, String) allow us to store only single data items in a variable, as does an array (well, not strictly, since an array can be of type Object). For example, when we store a number in an Integer variable, we can only store one number in the variable. With structures, we can store more than one piece of the data in the structure and the data can be of different types.

Type
Chapter
Information
Publisher: Cambridge University Press
Print publication year: 2004

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

  • Structures
  • Michael McMillan, Pulaski Technical College, Arkansas
  • Book: Object-Oriented Programming with Visual Basic.NET
  • Online publication: 06 July 2010
  • Chapter DOI: https://doi.org/10.1017/CBO9780511734861.004
Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

  • Structures
  • Michael McMillan, Pulaski Technical College, Arkansas
  • Book: Object-Oriented Programming with Visual Basic.NET
  • Online publication: 06 July 2010
  • Chapter DOI: https://doi.org/10.1017/CBO9780511734861.004
Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

  • Structures
  • Michael McMillan, Pulaski Technical College, Arkansas
  • Book: Object-Oriented Programming with Visual Basic.NET
  • Online publication: 06 July 2010
  • Chapter DOI: https://doi.org/10.1017/CBO9780511734861.004
Available formats
×