Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

auto_ptr question ??

4 views
Skip to first unread message

ArbolOne

unread,
Oct 28, 2009, 5:47:01 PM10/28/09
to
I have a program that declares an auto-pointer in the header file, and
then instantiate the pointer in the code file.
i.e.

tester.hpp
~~~~~~~
// My Class
#include "pulldownmenu.hpp"

//STD
#include <memory>

class Tester {
public:
Tester();
~Tester();
private:
PulldownMenu* pdm;

};
tester.cpp
~~~~~~~~
Tester::Tester(){

std::auto_ptr<PulldownMenu> pdm(jPulldownMenu);

}

Tester::~Tester(){}

=====
However, I have seen examples where the pointer is declared and
instantiated in the header file, i.e.
class Tester {
public:
Tester();
virtual ~Tester();
private:
std::auto_ptr<jme::PulldownMenu> pdm(jme::PulldownMenu);

};
=======
What difference does it make? the two ways compile OK!
pls go easy on me, I am new a this auto_ptr thing... :)

0 new messages