help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

auto_ptr question ??


From: ArbolOne
Subject: auto_ptr question ??
Date: Wed, 28 Oct 2009 14:47:01 -0700 (PDT)
User-agent: G2/1.0

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... :)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]