Click here to Skip to main content
16,006,594 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Declaring a pointer to a class in VC++ Pin
Anonymous7-Jun-04 4:23
Anonymous7-Jun-04 4:23 
GeneralCWnd custom control in Toolbar Pin
hd447807-Jun-04 2:52
hd447807-Jun-04 2:52 
GeneralPrinting mirror image Pin
CodeHead7-Jun-04 2:13
CodeHead7-Jun-04 2:13 
GeneralRe: Printing mirror image Pin
Roger Allen7-Jun-04 2:56
Roger Allen7-Jun-04 2:56 
GeneralSetWorldTransform() not work for printing? Pin
CodeHead7-Jun-04 9:57
CodeHead7-Jun-04 9:57 
GeneralCryptGetHashParam Pin
Ni@m7-Jun-04 0:41
Ni@m7-Jun-04 0:41 
GeneralRe: CryptGetHashParam Pin
Mike Dimmick7-Jun-04 4:57
Mike Dimmick7-Jun-04 4:57 
GeneralConstructor problem - setting members Pin
Anonymous7-Jun-04 0:16
Anonymous7-Jun-04 0:16 
Hello!

I have a class which has two constructors. One is a default and the other is the one I expect to use. In my class I have an COleDateTime member which I want to set in my constructor. I may need several constructors so I set most values in my default constructor and call my default constructor from my other constructors - I think this is OK yes?

But when in my program I create my object like this:

CMyObject *pMyObject = new CMyObject("My Object");


Debugging shows it calls the constructor but the COleDateTime m_Constructed member is not set to the current time. If I set it in the called constructor it is set as I want. Why is it not set if I call the default constructor from within my other constructor? I want it to work like this so that if I have more constructors I can set my members common to all constructors in the default constructor and call the default constructor from each of the other constructors.

Thanks. My code is below as an example:

class CMyObject
{
public:
  CMyObject();
  ~CMyObject(){}
  CMyObject(const char *title);
private:
  CString m_Title;
  COleDateTime m_Constructed; 
};

CMyObject::CMyObject()
{
  m_Title = "";
  m_Constructed = COleDateTime::GetCurrentTime();
}

CMyObject::CMyObject(const char *title)
{
  CMyObject();
  m_Title = title;
}

GeneralRe: Constructor problem - setting members Pin
bneacetp7-Jun-04 0:29
bneacetp7-Jun-04 0:29 
GeneralRe: Constructor problem - setting members Pin
thowra7-Jun-04 1:01
thowra7-Jun-04 1:01 
GeneralCreate a GUID to uniquely identify a machine. Pin
Member 11501767-Jun-04 0:06
Member 11501767-Jun-04 0:06 
GeneralRe: Create a GUID to uniquely identify a machine. Pin
Anonymous7-Jun-04 1:58
Anonymous7-Jun-04 1:58 
GeneralRe: Create a GUID to uniquely identify a machine. Pin
Joel Lucsy8-Jun-04 2:59
Joel Lucsy8-Jun-04 2:59 
QuestionHow to set Font of CStatic Control through Program.. Pin
Sumit Kapoor6-Jun-04 23:59
Sumit Kapoor6-Jun-04 23:59 
AnswerRe: How to set Font of CStatic Control through Program.. Pin
bneacetp7-Jun-04 0:18
bneacetp7-Jun-04 0:18 
GeneralRe: Still not work...also Pin
Sumit Kapoor7-Jun-04 0:34
Sumit Kapoor7-Jun-04 0:34 
GeneralRe: Still not work...also Pin
Johan Rosengren7-Jun-04 3:26
Johan Rosengren7-Jun-04 3:26 
GeneralRe: Forget ALSO... Pin
Sumit Kapoor7-Jun-04 0:36
Sumit Kapoor7-Jun-04 0:36 
GeneralRe: Forget ALSO... Pin
jmkhael7-Jun-04 4:50
jmkhael7-Jun-04 4:50 
GeneralNavigating through CForimView controls Pin
dart136-Jun-04 23:59
dart136-Jun-04 23:59 
GeneralRe: Navigating through CForimView controls Pin
Johan Rosengren7-Jun-04 6:10
Johan Rosengren7-Jun-04 6:10 
GeneralRe: Navigating through CForimView controls Pin
dart138-Jun-04 1:07
dart138-Jun-04 1:07 
GeneralRe: Navigating through CForimView controls Pin
Johan Rosengren8-Jun-04 1:24
Johan Rosengren8-Jun-04 1:24 
GeneralPrblm in video capturing Pin
Zeeshan Bilal6-Jun-04 23:32
Zeeshan Bilal6-Jun-04 23:32 
QuestionRetrieving control's original class by its ID? Pin
Daredevil6-Jun-04 23:13
Daredevil6-Jun-04 23:13 

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.