Click here to Skip to main content
15,867,141 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How can I treat VT_DATE ? Pin
_Flaviu14-Apr-11 0:26
_Flaviu14-Apr-11 0:26 
AnswerRe: How can I treat VT_DATE ? Pin
T210215-Apr-11 10:47
T210215-Apr-11 10:47 
QuestionHow to use One Pointer Object in another .cpp file? Pin
002comp13-Apr-11 23:44
002comp13-Apr-11 23:44 
AnswerRe: How to use One Pointer Object in another .cpp file? Pin
«_Superman_»14-Apr-11 0:44
professional«_Superman_»14-Apr-11 0:44 
GeneralRe: How to use One Pointer Object in another .cpp file? [modified] Pin
002comp14-Apr-11 1:35
002comp14-Apr-11 1:35 
AnswerRe: How to use One Pointer Object in another .cpp file? Pin
Albert Holguin15-Apr-11 4:35
professionalAlbert Holguin15-Apr-11 4:35 
AnswerRe: How to use One Pointer Object in another .cpp file? Pin
Stefan_Lang14-Apr-11 7:02
Stefan_Lang14-Apr-11 7:02 
AnswerRe: How to use One Pointer Object in another .cpp file? Pin
Albert Holguin14-Apr-11 14:43
professionalAlbert Holguin14-Apr-11 14:43 
Ok, I really hate the answers I'm seeing from other people.

In this code:
yogeshs wrote:
//CPP file A.cpp
/*In this class I want to create a Pointer of object in some function*/
TEST* _pObj = new TEST();
_pObj->num++;//num already initialize in constructor.

Why is this in A.cpp? He's creating an object of his own type? Although doable, don't think that's what you're trying to accomplish.

If this object is to be used in SAMPLE.cpp, then that's where it should be initialized and accessed (now you don't have to do it this way, but I think that's what you're trying to do).

In Sample.h or Sample.cpp:
//This will allow you to access that member at any point in Sample.cpp
#include "A.h"

class CSample
{
  public:
   CSample(){m_obj = new TEST;} //Initialize m_obj
   ~CSample(){delete m_obj;}    //Delete to free heap memory

  private:
   TEST* m_obj;                 //Members are accessible anywhere in the class
};


[edit]
If I'm wrong on what you're trying to accomplish, let me know and I'll clear it up for you.
[/edit]
GeneralRe: How to use One Pointer Object in another .cpp file? [modified] Pin
002comp14-Apr-11 21:14
002comp14-Apr-11 21:14 
GeneralRe: How to use One Pointer Object in another .cpp file? Pin
Stefan_Lang14-Apr-11 23:18
Stefan_Lang14-Apr-11 23:18 
GeneralRe: How to use One Pointer Object in another .cpp file? Pin
002comp15-Apr-11 2:24
002comp15-Apr-11 2:24 
GeneralRe: How to use One Pointer Object in another .cpp file? Pin
Stefan_Lang15-Apr-11 4:42
Stefan_Lang15-Apr-11 4:42 
GeneralRe: How to use One Pointer Object in another .cpp file? Pin
Albert Holguin15-Apr-11 4:29
professionalAlbert Holguin15-Apr-11 4:29 
AnswerRe: How to use One Pointer Object in another .cpp file? Pin
Code-o-mat14-Apr-11 23:07
Code-o-mat14-Apr-11 23:07 
QuestionHow to convert filename to fully qualified name when running an app with a filename argument in the current working directory Pin
Erik13-Apr-11 20:05
Erik13-Apr-11 20:05 
AnswerRe: How to convert filename to fully qualified name when running an app with a filename argument in the current working directory Pin
«_Superman_»13-Apr-11 21:30
professional«_Superman_»13-Apr-11 21:30 
GeneralRe: How to convert filename to fully qualified name when running an app with a filename argument in the current working directory Pin
Erik14-Apr-11 0:00
Erik14-Apr-11 0:00 
GeneralCMFCEditBrowseCtrl leaks... Pin
danLenehan13-Apr-11 8:51
danLenehan13-Apr-11 8:51 
GeneralRe: CMFCEditBrowseCtrl leaks... Pin
Maximilien13-Apr-11 9:42
Maximilien13-Apr-11 9:42 
GeneralRe: CMFCEditBrowseCtrl leaks... Pin
danLenehan13-Apr-11 13:48
danLenehan13-Apr-11 13:48 
GeneralRe: CMFCEditBrowseCtrl leaks... Pin
Maximilien13-Apr-11 14:15
Maximilien13-Apr-11 14:15 
QuestionTried Searching but Can't find the Answer Pin
JohnnyG13-Apr-11 8:20
JohnnyG13-Apr-11 8:20 
AnswerRe: Tried Searching but Can't find the Answer Pin
Albert Holguin13-Apr-11 8:27
professionalAlbert Holguin13-Apr-11 8:27 
GeneralRe: Tried Searching but Can't find the Answer Pin
JohnnyG13-Apr-11 8:39
JohnnyG13-Apr-11 8:39 
GeneralRe: Tried Searching but Can't find the Answer Pin
Albert Holguin13-Apr-11 9:56
professionalAlbert Holguin13-Apr-11 9:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.