Click here to Skip to main content
15,922,584 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: DialogBox question Pin
Mark Salsbery8-Dec-07 9:25
Mark Salsbery8-Dec-07 9:25 
GeneralRe: DialogBox question Pin
KellyR8-Dec-07 9:37
KellyR8-Dec-07 9:37 
GeneralGDI+ trailing spaces and newline Pin
bob169728-Dec-07 5:59
bob169728-Dec-07 5:59 
GeneralWindow Styles Pin
Giorgi Dalakishvili8-Dec-07 4:32
mentorGiorgi Dalakishvili8-Dec-07 4:32 
GeneralRe: Window Styles Pin
Mark Salsbery8-Dec-07 6:23
Mark Salsbery8-Dec-07 6:23 
QuestionC++ resource file Pin
Somaiia7-Dec-07 21:44
Somaiia7-Dec-07 21:44 
GeneralRe: C++ resource file Pin
Mark Salsbery8-Dec-07 6:30
Mark Salsbery8-Dec-07 6:30 
QuestionDoes vs2008 support source control? How can vss for vc6 migrate to vs2008? Pin
followait7-Dec-07 16:34
followait7-Dec-07 16:34 
AnswerRe: Does vs2008 support source control? How can vss for vc6 migrate to vs2008? Pin
Christian Graus7-Dec-07 17:57
protectorChristian Graus7-Dec-07 17:57 
GeneralGetItemRect(iItem,&rt,LVIR_ICON), the result in rt is not accurate Pin
followait7-Dec-07 16:22
followait7-Dec-07 16:22 
Generaltellp, tellg, seekp, seekg Pin
clint19827-Dec-07 15:24
clint19827-Dec-07 15:24 
QuestionRe: tellp, tellg, seekp, seekg Pin
David Crow7-Dec-07 16:43
David Crow7-Dec-07 16:43 
QuestionRe: tellp, tellg, seekp, seekg Pin
clint19827-Dec-07 22:18
clint19827-Dec-07 22:18 
QuestionRe: tellp, tellg, seekp, seekg Pin
CPallini8-Dec-07 11:00
mveCPallini8-Dec-07 11:00 
QuestionWhich Mouse? Pin
RobertE7-Dec-07 12:55
RobertE7-Dec-07 12:55 
GeneralRe: Which Mouse? Pin
Anthony Mushrow7-Dec-07 14:56
professionalAnthony Mushrow7-Dec-07 14:56 
GeneralRe: Which Mouse? Pin
Mike Dimmick7-Dec-07 16:11
Mike Dimmick7-Dec-07 16:11 
GeneralRe: Which Mouse? Pin
Storm-blade8-Dec-07 10:45
professionalStorm-blade8-Dec-07 10:45 
QuestionRe: Which Mouse? Pin
RobertE9-Dec-07 8:17
RobertE9-Dec-07 8:17 
GeneralKnowing when user deletes a file with CFileDialog Pin
Henri7-Dec-07 7:55
Henri7-Dec-07 7:55 
GeneralRe: Knowing when user deletes a file with CFileDialog Pin
Maximilien7-Dec-07 9:11
Maximilien7-Dec-07 9:11 
GeneralRe: Knowing when user deletes a file with CFileDialog Pin
Mark Salsbery7-Dec-07 9:18
Mark Salsbery7-Dec-07 9:18 
GeneralClass Constructor Problem Pin
Lea Hayes7-Dec-07 6:47
Lea Hayes7-Dec-07 6:47 
Hi all,

I have a class, for the purposes of this message 'class AClass'. The class requires a copy-constructor for the typical purposes. The following represents what I usually do:

class AClass<br />
{<br />
public:<br />
   AClass();<br />
   AClass(const AClass& copy_from);<br />
<br />
   ...<br />
};


In my implementation 'AClass' initiates a large amount of data whilst potentially undertaking a fairly complex procedure. The entire procedure can be optimised very easily when a non-constant version of the object is supplied:

class AClass<br />
{<br />
public:<br />
   AClass();<br />
   AClass(AClass& copy_from);<br />
<br />
   ...<br />
};


However, this leads to a different problem because the 'const' keyword is no longer used. There are places within my application which must parse such objects as 'const'. So the natural solution would seem the following:

class AClass<br />
{<br />
public:<br />
   AClass();<br />
   AClass(AClass& copy_from);<br />
   AClass(const AClass& copy_from);<br />
<br />
   ...<br />
};


Sadly the above produces the following warning message:
'warning C4521: 'AClass' : multiple copy constructors specified'

I know there are workarounds which involve 'const_cast', but in my application the two copy constructors need to behave differently. Also, it isn't appropriate to use pointers and references to avoid this issue because it would cause serious maintenance issues and would be too confusing.

Any help or advice would be great.
Lea Hayes
GeneralRe: Class Constructor Problem Pin
Lea Hayes7-Dec-07 7:13
Lea Hayes7-Dec-07 7:13 
GeneralRe: Class Constructor Problem Pin
Cedric Moonen7-Dec-07 7:15
Cedric Moonen7-Dec-07 7:15 

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.