diff options
author | Christopher Faylor <me@cgf.cx> | 2000-02-17 19:38:33 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2000-02-17 19:38:33 +0000 |
commit | 1fd5e000ace55b323124c7e556a7a864b972a5c4 (patch) | |
tree | dc4fcf1e5e22a040716ef92c496b8d94959b2baa /winsup/mingw/samples/dlltest/silly.cpp | |
parent | 369d8a8fd5e887eca547bf34bccfdf755c9e5397 (diff) | |
download | cygnal-1fd5e000ace55b323124c7e556a7a864b972a5c4.tar.gz cygnal-1fd5e000ace55b323124c7e556a7a864b972a5c4.tar.bz2 cygnal-1fd5e000ace55b323124c7e556a7a864b972a5c4.zip |
import winsup-2000-02-17 snapshot
Diffstat (limited to 'winsup/mingw/samples/dlltest/silly.cpp')
-rw-r--r-- | winsup/mingw/samples/dlltest/silly.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/winsup/mingw/samples/dlltest/silly.cpp b/winsup/mingw/samples/dlltest/silly.cpp new file mode 100644 index 000000000..70f5af5c7 --- /dev/null +++ b/winsup/mingw/samples/dlltest/silly.cpp @@ -0,0 +1,55 @@ +//
+// C++ test of a dll which contains a C++ class.
+//
+
+#include <stdlib.h>
+#include <stdio.h>
+
+// Interface of class.
+#include "silly.h"
+
+#ifdef DERIVED_TEST
+// Here is a derived class too.
+class CMoreSilly : public CSilly
+{
+ public:
+ CMoreSilly (char* szNewName) : CSilly (szNewName) {};
+ ~CMoreSilly ();
+
+ WhatsYourName();
+};
+
+CMoreSilly::
+~CMoreSilly ()
+{
+ printf ("In CMoreSilly \"%s\" destructor!\n", szName);
+}
+
+CMoreSilly::
+WhatsYourName ()
+{
+ printf ("I'm more silly and my name is \"%s\"\n", szName);
+}
+#endif
+
+int
+main ()
+{
+ CSilly* psilly = new CSilly("silly");
+
+ psilly->WhatsYourName();
+ psilly->Poke(); // Poke him, he should say "Ouch!"
+ psilly->Stab(4); // Stab him four times he should say "Ugh!!!!"
+
+ delete psilly;
+
+#ifdef DERIVED_TEST
+ psilly = new CMoreSilly("more silly");
+ psilly->WhatsYourName();
+ psilly->Stab(5);
+ delete psilly;
+#endif
+
+ return 0;
+}
+
|