Click here to Skip to main content
15,921,577 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionC++ destructor Pin
Fred Andres30-Nov-08 5:35
Fred Andres30-Nov-08 5:35 
AnswerRe: C++ destructor Pin
PJ Arends30-Nov-08 7:03
professionalPJ Arends30-Nov-08 7:03 
GeneralRe: C++ destructor Pin
Fred Andres30-Nov-08 7:27
Fred Andres30-Nov-08 7:27 
AnswerRe: C++ destructor Pin
Mark Salsbery30-Nov-08 7:19
Mark Salsbery30-Nov-08 7:19 
QuestionConverting an integer to a string. Pin
Quecumber25630-Nov-08 5:17
Quecumber25630-Nov-08 5:17 
AnswerRe: Converting an integer to a string. Pin
PJ Arends30-Nov-08 6:57
professionalPJ Arends30-Nov-08 6:57 
AnswerRe: Converting an integer to a string. Pin
Mark Salsbery30-Nov-08 7:24
Mark Salsbery30-Nov-08 7:24 
QuestionWhat is the difference between these 2 ways of declaring an object? Pin
KaKa'30-Nov-08 3:20
KaKa'30-Nov-08 3:20 
While I was reading some C++ code, I saw a code snippet which declared an object like this:

#include <string>
#include <cassert>
#include "BaseGameEntity.h"
#include "Locations.h"

class State;

class Miner : public BaseGameEntity
{
   private:

      State* m_pCurrentState; 
      .....
};


Another way of declaring an object is to include the header file and then declare the object in the class:

#include <string>
#include <cassert>
#include "BaseGameEntity.h"
#include "Locations.h"
#include "State.h"

class Miner : public BaseGameEntity
{
   private:

      State m_pCurrentState; 
      .....
};


Yes, in the first code snippet, an object pointer is declared while in the second one, it is a normal object.
Other than that,is there difference between these 2 ways of declaring an object?

When should either method be used? Confused | :confused:
AnswerRe: What is the difference between these 2 ways of declaring an object? Pin
Jijo.Raj30-Nov-08 4:25
Jijo.Raj30-Nov-08 4:25 
GeneralRe: What is the difference between these 2 ways of declaring an object? Pin
KaKa'30-Nov-08 22:41
KaKa'30-Nov-08 22:41 
QuestionCFileDialog maximum file number Pin
followait30-Nov-08 2:31
followait30-Nov-08 2:31 
AnswerRe: CFileDialog maximum file number Pin
PJ Arends30-Nov-08 6:50
professionalPJ Arends30-Nov-08 6:50 
GeneralRe: CFileDialog maximum file number Pin
Hans Dietrich30-Nov-08 23:36
mentorHans Dietrich30-Nov-08 23:36 
QuestionIWebBrowser2 focus problem with IE6 Pin
YaronNir30-Nov-08 1:04
YaronNir30-Nov-08 1:04 
AnswerRe: IWebBrowser2 focus problem with IE6 Pin
PJ Arends30-Nov-08 7:12
professionalPJ Arends30-Nov-08 7:12 
GeneralRe: IWebBrowser2 focus problem with IE6 Pin
YaronNir30-Nov-08 19:35
YaronNir30-Nov-08 19:35 
GeneralRe: IWebBrowser2 focus problem with IE6 Pin
PJ Arends1-Dec-08 8:22
professionalPJ Arends1-Dec-08 8:22 
GeneralRe: IWebBrowser2 focus problem with IE6 Pin
YaronNir1-Dec-08 22:06
YaronNir1-Dec-08 22:06 
QuestionArray of Pointers to Functions & Math [modified] Pin
evdoxus30-Nov-08 0:04
evdoxus30-Nov-08 0:04 
AnswerRe: Array of Pointers to Functions & Math Pin
Richard Andrew x6430-Nov-08 3:44
professionalRichard Andrew x6430-Nov-08 3:44 
QuestionWM_CTLCOLOREDIT with Multiline Dialog Edit control Pin
ForNow29-Nov-08 15:53
ForNow29-Nov-08 15:53 
AnswerRe: WM_CTLCOLOREDIT with Multiline Dialog Edit control Pin
PJ Arends30-Nov-08 7:05
professionalPJ Arends30-Nov-08 7:05 
GeneralRe: WM_CTLCOLOREDIT with Multiline Dialog Edit control Pin
ForNow30-Nov-08 7:35
ForNow30-Nov-08 7:35 
GeneralRe: WM_CTLCOLOREDIT EM_POSFROMCHAR&TextOut Pin
ForNow30-Nov-08 9:18
ForNow30-Nov-08 9:18 
QuestionA Question about Input Fields Pin
BobInNJ29-Nov-08 13:46
BobInNJ29-Nov-08 13:46 

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.