Index

C & C++ Programming - Auto Pointers

#include "stdafx.h"
#include "memory.h"

class ABC
{
public:
 ABC();

 void Printf() const;
};

typedef auto_ptr< abc > ptr;

ABC::ABC()
{
 cout << "WELCOME";
}

void ABC::Printf() const
{
 cout << "Function Called";
}

void f(ABC& a)
{
 a.Printf();
}

void f(const ABC& a)
{
 a.Printf();
}

void TestAutoPtr()
{
 ptr p(new ABC());

 p->Printf();
}

Index