home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
VSCPPv8.zip
/
VACPP
/
IBMCPP
/
samples
/
IOC
/
GRAPH
/
GRAPH.H
< prev
next >
Wrap
Text File
|
1995-03-15
|
2KB
|
79 lines
/*************************************************************************
IBM C/C++ Tools Version 3.00 - Collection Class Library
(C) Copyright IBM Corporation 1992 ,1995, Licensed Program-Property of
IBM. All Rights Reserved. US Government Users Restricted Rights - Use,
duplication or disclosure restricted by GSA ADP Schedule Contract with
IBM Corp.
*************************************************************************/
#if defined (_SUN)
#include <istring.h>
#else
#include <istring.hpp>
#endif
#include <iostream.h>
class Graphics
{
protected:
IString ivId; //*** graphics ID ****/
int ivKey; //*** graphics key ****/
public:
Graphics (int graphicsKey, IString id) : ivKey(graphicsKey),
ivId(id)
{ }
~Graphics()
{
cout << this->ivId
<< " will now be deleted ... "
<< endl;
}
IBoolean operator== (Graphics const& graphics) const
{
return (this->ivId == graphics.ivId);
}
IString const& id() const
{
return ivId;
}
virtual void draw() const =0;
/**** This member function returns the graphic's key ****/
/* Note that we are returning the int by reference, */
/* because this member function will be used by the */
/* key(...) function, which must return a reference. */
/********************************************************/
int const& graphicsKey() const
{
return ivKey;
}
};
/**************** key function *********************/
/**** note that this interface must always be used with: ****/
/**** Keytype const& key(....) ****/
/**** ****/
/**** We are providing this key function for the element ****/
/**** type Graphics and not for the managed pointer. ****/
/***************************************************************/
inline int const& key (Graphics const& graphics)
{
return graphics.graphicsKey();
}