diff options
author | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-04-22 20:44:50 +0000 |
---|---|---|
committer | nanbor <nanbor@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-04-22 20:44:50 +0000 |
commit | 14122dcc74b9f16790be4089be52144200c0df73 (patch) | |
tree | fd10b0734b893b8805c0e9aa82a40fb825b010c7 /examples/DLL | |
parent | 45927c4b45ee2535af8af97f60f47899b133cfae (diff) | |
download | ATCD-14122dcc74b9f16790be4089be52144200c0df73.tar.gz |
ChangeLogTag:Mon Apr 22 15:43:15 2002 Nanbor Wang <nanbor@cs.wustl.edu>
Diffstat (limited to 'examples/DLL')
-rw-r--r-- | examples/DLL/Newsweek.cpp | 13 | ||||
-rw-r--r-- | examples/DLL/Newsweek.h | 14 | ||||
-rw-r--r-- | examples/DLL/Today.cpp | 13 | ||||
-rw-r--r-- | examples/DLL/Today.h | 16 |
4 files changed, 45 insertions, 11 deletions
diff --git a/examples/DLL/Newsweek.cpp b/examples/DLL/Newsweek.cpp index cd06013c41a..33e6d9868a6 100644 --- a/examples/DLL/Newsweek.cpp +++ b/examples/DLL/Newsweek.cpp @@ -12,7 +12,18 @@ void Newsweek::title (void) { ACE_DEBUG ((LM_DEBUG, - "Newsweek: Vol 23 Dec87\n")); + "Newsweek: Vol. 44923 Stardate: 12.3054\n")); +} + +void * +Newsweek::operator new (size_t bytes) +{ + return ::new char[bytes]; +} +void +Newsweek::operator delete (void *ptr) +{ + delete [] ((char *) ptr); } // Returns the Newsweek class pointer. diff --git a/examples/DLL/Newsweek.h b/examples/DLL/Newsweek.h index 65f2a36f5d6..2e6d634cafa 100644 --- a/examples/DLL/Newsweek.h +++ b/examples/DLL/Newsweek.h @@ -10,7 +10,7 @@ // Newsweek.h // // = DESCRIPTION -// This is a derived class from Magazine which is a magazine +// This is a derived class from Magazine which is a magazine // pertaining to news and information. // // = AUTHOR @@ -30,16 +30,22 @@ class Newsweek : public Magazine { - //= TITLE + //= TITLE // This is an derived class of Magazine. - // + // //= DESCRIPTION // Polymoriphism is exploited and an object pointer // of Magazine is bound to the Newsweek object at runtime. public: - void title (void); // This is the abstract class method which describes the magazine. + void title (void); + + // Overload the new/delete opertors so the object will be + // created/deleted using the memory allocator associated with the + // DLL/SO. + void *operator new (size_t bytes); + void operator delete (void *ptr); }; # endif /* NEWSWEEK_H */ diff --git a/examples/DLL/Today.cpp b/examples/DLL/Today.cpp index cb08d62a7c3..1cc087f38f4 100644 --- a/examples/DLL/Today.cpp +++ b/examples/DLL/Today.cpp @@ -13,7 +13,18 @@ void Today::title (void) { ACE_DEBUG ((LM_DEBUG, - "Today: Information Technology Special Nov98\n")); + "Today: XML Special Apr 02\n")); +} + +void * +Today::operator new (size_t bytes) +{ + return ::new char[bytes]; +} +void +Today::operator delete (void *ptr) +{ + delete [] ((char *) ptr); } // Returns the pointer to the Today class. diff --git a/examples/DLL/Today.h b/examples/DLL/Today.h index 3e27b63b1c6..6b0fdaa2c28 100644 --- a/examples/DLL/Today.h +++ b/examples/DLL/Today.h @@ -10,7 +10,7 @@ // Today.h // // = DESCRIPTION -// This class denotes the Today magazine which is derived from +// This class denotes the Today magazine which is derived from // Magazine. // // = AUTHOR @@ -30,17 +30,23 @@ class Today : public Magazine { - // = TITLE + // = TITLE // This is an derived class of Magazine. - // + // // = DESCRIPTION - // Polymoriphism is exploited and an object pointer of Magazine + // Polymoriphism is exploited and an object pointer of Magazine // is bound to the Today object at runtime. public: - void title (void); // The virtual abstract class method which returns the title of the // magazine. + void title (void); + + // Overload the new/delete opertors so the object will be + // created/deleted using the memory allocator associated with the + // DLL/SO. + void *operator new (size_t bytes); + void operator delete (void *ptr); }; #endif /* TODAY_H */ |