- Inside Macintosh: Programmer's Guide to MacApp / Part 2 - Working With MacApp
Chapter 10 -
Working With Objects
This chapter provides recipes and sample code for performing basic operations with objects. The recipes demonstrate how to
- define a class by providing
- a class definition
- runtime type information
- constructor and destructor methods
- an initialization method
- create an instance of a class, initialize it, and delete the object when it is no longer needed
- use dynamic casting to convert between class types
- determine whether an object descends from a specified class
Before reading this chapter, you should read Chapter 2, "Basic Operations," which describes MacApp's basic object class, TObject, and MacApp's runtime type information (RTTI) mechanism.
Chapter Contents
- Overview
-
- Choosing an Object Class
-
- Creating Objects
-
- Providing Runtime Type Information for a Class
-
- Recipes--Objects
-
- Recipe--Defining a Class
-
- Provide a Class Definition
-
- Provide Runtime Type Information in the Implementation
-
- Provide Constructor and Destructor Methods
-
- Provide an Initialization Method
-
- Override Additional Methods
-
- Recipe--Creating, Initializing, and Deleting an Object
-
- Create and Initialize an Instance of a Class
-
- Delete the Object When It Is No Longer Needed
-
- Recipe--Dynamic Casting Between Class Types
-
- Recipe--Determining Whether an Object Descends From a Specified Class
-
© Apple Computer, Inc.
25 JUL 1996