Published online by Cambridge University Press: 05 June 2012
VB Quip
But what is it good for? – an engineer at the Advanced Computing Systems Division of IBM, commenting on the microchip in 1968
Think of objects as tools. Better yet, think of them as building blocks. Imagine how hard a job would be if you had to create everything from scratch every time. Say you wanted to build a table. First, you'd need to make an axe to cut down the tree. Then you'd have to make a saw to cut the wood. You'd have to make your own nails to piece together the table, but that's only after you made your own hammer so you could pound the nails. Programming is like that sometimes – OK, usually. And it was certainly that way years ago. Everything was done from scratch and very little was reusable. However, there's been some progress since then. You saw reusable code when you learned procedures and functions. Objects and classes are that way, but on a grander scale. The controls in the Toolbox are objects, each specially created for a specific task. They're tools and, without them, development would be much tougher, and a whole lot less fun. Classes are code that defines an abstract data type – it's a thing, and the developer provides a description of it and determines how it can be used. This chapter shows you how to create objects with your code and how to define and use classes.
To save this book to your Kindle, first ensure [email protected] 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.
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.
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.