Feb 94 Top 10
Volume Number: 10
Issue Number: 2
Column Tag: Think top 10
Mixing C++ and the Toolbox
By Christopher Prinos, Symantec Technical Support, Symantec Corp.
Note: Source code files accompanying article are located on MacTech CD-ROM or
source code disks.
This is a monthly column written by Symantec’s Technical Support Engineers
intended to provide you with information on Symantec products. Each month we cover
either a specific application of tools or a “Q&A” list.
As the use of C++ continues to grow in the Macintosh community, programmers
are faced with the challenge of learning ways to bring the added capabilities of the C++
language to their Macintosh development projects. A large number of people that
contact us everyday are just getting their hands wet in the Toolbox, even more are just
starting to learn C++. Bringing the two together is commonly described in the context
of class libraries like the THINK Class Library and MacApp, and although these
libraries provide powerful vehicles to develop object-oriented Macintosh
applications, they may be a bit overwhelming at first. Those coming up to speed in
C++ are often looking a for nudge in the right direction to start their Mac specific
projects, without having to assimilate a large class library with its possibly subtle
interaction between a large number of classes.
This article will take a more straightforward approach. We will build a C++
class using features like operator overloading, nested classes, and reference counting
to implement a wrapper for QuickDraw regions that allows us to use them in a more
intuitive and elegant manner. The final result will be a stand-alone class that doesn’t
rely on a supporting cast of other classes to be effective, showing a concrete example of