Category : Files from Magazines
Archive   : CUJ9208.ZIP
Filename : 1008085A

 
Output of file : 1008085A contained in archive : CUJ9208.ZIP
// main1.cpp
// a quick test of RefCntPtr

#define DEBUG

#include "anyclass.hpp"

void main (void)
{
RefCntPtr(anyClass) ptr1;

// should evaluate to false,
// not execute show
if (ptr1)
ptr1->show();

ptr1 = new anyClass;
if (!ptr1)
cout << "new failed\n";

ptr1->intVal = 17;
ptr1->string =
"I wanna go to Australia, too";

// another access method
(*ptr1).show();

RefCntPtr(anyClass) ptr2 = ptr1;
ptr2->show();

ptr1 = 0;
// this one is an error
ptr1->show();

ptr2->show();

// previous anyClass will be deleted
ptr2 = new anyClass;
ptr2->intVal = 1234;
ptr2->string =
"Kansas? Why?";

// ptr2 destructor will be called here,
// at end of function, resulting
// in call to anyClass destructor
};


  3 Responses to “Category : Files from Magazines
Archive   : CUJ9208.ZIP
Filename : 1008085A

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/