Click here to Skip to main content
15,884,986 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCString Problems Pin
#realJSOP26-Jul-04 0:54
mve#realJSOP26-Jul-04 0:54 
GeneralRe: CString Problems Pin
palbano26-Jul-04 7:33
palbano26-Jul-04 7:33 
Questionno copy constructor? Pin
feline_dracoform26-Jul-04 0:09
feline_dracoform26-Jul-04 0:09 
AnswerRe: no copy constructor? Pin
David Crow26-Jul-04 3:53
David Crow26-Jul-04 3:53 
GeneralRe: no copy constructor? Pin
feline_dracoform27-Jul-04 2:02
feline_dracoform27-Jul-04 2:02 
GeneralRe: no copy constructor? Pin
David Crow27-Jul-04 3:39
David Crow27-Jul-04 3:39 
AnswerRe: no copy constructor? Pin
palbano26-Jul-04 7:53
palbano26-Jul-04 7:53 
GeneralRe: no copy constructor? Pin
feline_dracoform27-Jul-04 1:12
feline_dracoform27-Jul-04 1:12 
*oops*
yes, i discovered a copy constructor isn't the same as an assignment operator after quite a bit of reading yesterday. it is a few years since i have done much C++, and i had forgotten this.

the problem function was:

result *002burnsResult::cloneResult(ParentResult *newParent)
{
    002burnsResult *newResult = new 002burnsResult;
    *newResult = *this;   // this is the problem line
    newResult->setParent(newParent);
    return newResult;
}


feeling confused, i tried to compile the same class under UNIX. this also refused to work, but the compiler told me it was unable to construct a default copy constructor for the class Confused | :confused: i didn't even get as far as this function.

i think having a class member of type QValueVector<QString> is causing this problem, but i have no idea why. i am guessing Qt have done something strange in their classes.

writing a copy constructor, and switching to:
002burnsResult *newResult = new resultBurns(*this);<br />

works fine. the thing is, all i have done in my copy constructor is a list of a = rhs.a lines, one per class member.

at least this works, and i have re-learnt a bit of C++. i would still like to understand why this didn't work though.
Generaldisable a submenu item on runtime in an MFC app Pin
caykahve25-Jul-04 23:35
caykahve25-Jul-04 23:35 
GeneralRe: disable a submenu item on runtime in an MFC app Pin
Anonymous25-Jul-04 23:45
Anonymous25-Jul-04 23:45 
GeneralRe: disable a submenu item on runtime in an MFC app Pin
caykahve25-Jul-04 23:52
caykahve25-Jul-04 23:52 
GeneralRe: disable a submenu item on runtime in an MFC app Pin
V.25-Jul-04 23:47
professionalV.25-Jul-04 23:47 
GeneralRe: disable a submenu item on runtime in an MFC app Pin
caykahve26-Jul-04 0:24
caykahve26-Jul-04 0:24 
Generalmultiple text in status-bar Pin
Anonymous25-Jul-04 23:21
Anonymous25-Jul-04 23:21 
GeneralPosition the mouse on a web browser programmatically Pin
yourbuddy7725-Jul-04 21:22
yourbuddy7725-Jul-04 21:22 
Generalline comparison on word basis Pin
mfc_surfer25-Jul-04 20:46
mfc_surfer25-Jul-04 20:46 
Questiondynamically create controls and attaching listeners to them? Pin
misterbear25-Jul-04 20:23
misterbear25-Jul-04 20:23 
AnswerRe: dynamically create controls and attaching listeners to them? Pin
KarstenK25-Jul-04 21:14
mveKarstenK25-Jul-04 21:14 
GeneralBut how to attach a message handler dynamically? Pin
misterbear26-Jul-04 0:04
misterbear26-Jul-04 0:04 
Questiondynamically create controls and attaching listeners to them? Pin
misterbear25-Jul-04 20:23
misterbear25-Jul-04 20:23 
GeneralGDI Objects Pin
0v3rloader25-Jul-04 13:25
0v3rloader25-Jul-04 13:25 
GeneralRe: GDI Objects Pin
Ravi Bhavnani25-Jul-04 14:54
professionalRavi Bhavnani25-Jul-04 14:54 
GeneralRe: GDI Objects Pin
Michael Dunn25-Jul-04 18:21
sitebuilderMichael Dunn25-Jul-04 18:21 
GeneralRe: GDI Objects Pin
Antony M Kancidrowski26-Jul-04 2:06
Antony M Kancidrowski26-Jul-04 2:06 
GeneralReadfile from *.txt Pin
71cwill25-Jul-04 8:39
71cwill25-Jul-04 8:39 

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.