Important: The information in this document is obsolete and should not be used for new development.
Chapter 10 -
This chapter provides recipes and sample code for performing basic operations with objects. The recipes demonstrate how to
Working With Objects
Before reading this chapter, you should read Chapter 2, "Basic Operations," which describes MacApp's basic object class,
- 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
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