Click here to Skip to main content
15,905,914 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CCriticalSection - volatile? Pin
26-Oct-02 13:00
suss26-Oct-02 13:00 
GeneralRe: CCriticalSection - volatile? Pin
Neville Franks26-Oct-02 13:34
Neville Franks26-Oct-02 13:34 
General10x Pin
Anonymous26-Oct-02 14:19
Anonymous26-Oct-02 14:19 
GeneralParaller Port Comunication. Pin
int01h26-Oct-02 9:12
int01h26-Oct-02 9:12 
GeneralRe: Paraller Port Comunication. Pin
Gary R. Wheeler27-Oct-02 3:56
Gary R. Wheeler27-Oct-02 3:56 
GeneralRe: Paraller Port Comunication. Pin
Daniel Strigl28-Oct-02 0:41
Daniel Strigl28-Oct-02 0:41 
GeneralOperator overloading! Help! Pin
26-Oct-02 8:43
suss26-Oct-02 8:43 
GeneralRe: Operator overloading! Help! Pin
Paul M Watt26-Oct-02 11:36
mentorPaul M Watt26-Oct-02 11:36 
I am not sure what you mean by the overload operator?

As far as the assignment operator, this is what you need to do:

1: check for a reference to the current object. There is no sense in reassigning of you are doing something like this:

Object A;
A = A;

Here is the code you use to do that check:

myString &operator=(const myString& rhs)
{
if (*this == rhs)
{
return *this;
}
...
}

2: delete all of your existing memory, to prevent memory leaks.
delete[] theString;
theString = NULL;

3: allocate and copy the data from the input parameters.
if (rhs.theString)
{
length = strlen(rhs.theString) + 1;
theString = new char[length];
strcpy(theString, rhs.theString);
}

4: Returns a reference to this object to make things like this possible:
Object A, B, C;
...
A = B= C;

Here is the code to do this:

return *this;

Good Luck


Build a man a fire, and he will be warm for a day
Light a man on fire, and he will be warm for the rest of his life!

GeneralRe: Operator overloading! Help! Pin
MGraw26-Oct-02 14:38
sussMGraw26-Oct-02 14:38 
GeneralRe: Operator overloading! Help! Pin
Paul M Watt26-Oct-02 19:44
mentorPaul M Watt26-Oct-02 19:44 
GeneralRe: Operator overloading! Help! Pin
MGraw27-Oct-02 8:51
sussMGraw27-Oct-02 8:51 
GeneralNeed Help(CDC) Pin
26-Oct-02 6:26
suss26-Oct-02 6:26 
GeneralRe: Need Help(CDC) Pin
Chris Losinger26-Oct-02 11:32
professionalChris Losinger26-Oct-02 11:32 
QuestionHow to programmatically generate GUIDs? Pin
Abin26-Oct-02 6:15
Abin26-Oct-02 6:15 
AnswerRe: How to programmatically generate GUIDs? Pin
Michael Dunn26-Oct-02 6:54
sitebuilderMichael Dunn26-Oct-02 6:54 
AnswerRe: How to programmatically generate GUIDs? Pin
Alexander Wiseman26-Oct-02 9:48
Alexander Wiseman26-Oct-02 9:48 
GeneralRe: How to programmatically generate GUIDs? Pin
Abin26-Oct-02 10:28
Abin26-Oct-02 10:28 
QuestionDLL function export ? Pin
Stan the man26-Oct-02 5:45
Stan the man26-Oct-02 5:45 
AnswerRe: DLL function export ? Pin
Paul M Watt26-Oct-02 6:37
mentorPaul M Watt26-Oct-02 6:37 
Questionare they the same? Pin
includeh1026-Oct-02 4:57
includeh1026-Oct-02 4:57 
AnswerRe: are they the same? Pin
Gary R. Wheeler27-Oct-02 3:39
Gary R. Wheeler27-Oct-02 3:39 
GeneralVisual Studio .NET problem, please help. Pin
Anonymous26-Oct-02 3:38
Anonymous26-Oct-02 3:38 
GeneralRe: Visual Studio .NET problem, please help. Pin
Stephane Rodriguez.26-Oct-02 3:50
Stephane Rodriguez.26-Oct-02 3:50 
Questionhow to change button color and how to ctivate te horizontal defilement bar of a lis Pin
a_hic26-Oct-02 0:53
a_hic26-Oct-02 0:53 
AnswerRe: how to change button color and how to ctivate te horizontal defilement bar of a lis Pin
Nish Nishant26-Oct-02 1:47
sitebuilderNish Nishant26-Oct-02 1:47 

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.