Click here to Skip to main content
16,011,358 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Virtual Keys :: MFC Pin
valikac17-Mar-02 13:21
valikac17-Mar-02 13:21 
GeneralRe: Virtual Keys :: MFC Pin
Michael Dunn17-Mar-02 13:28
sitebuilderMichael Dunn17-Mar-02 13:28 
GeneralBitmaps Pin
17-Mar-02 6:15
suss17-Mar-02 6:15 
GeneralRe: Bitmaps Pin
Paul M Watt17-Mar-02 7:36
mentorPaul M Watt17-Mar-02 7:36 
GeneralRe: Bitmaps Pin
Paul M Watt18-Mar-02 5:29
mentorPaul M Watt18-Mar-02 5:29 
QuestionRestrict Multiple Instance of an Exe? Pin
17-Mar-02 5:04
suss17-Mar-02 5:04 
AnswerRe: Restrict Multiple Instance of an Exe? Pin
Tim Smith17-Mar-02 6:01
Tim Smith17-Mar-02 6:01 
GeneralMy Copy Constructor bug problem Pin
John Cruz17-Mar-02 3:37
John Cruz17-Mar-02 3:37 
hello. i am currently writing a program tictactoe for windows. i got mostly everything working. i got the program to draw the board and draw the X's and O's. the game start by beginning with the player then wait for the computer to move. i got the part where the player clicks on the board and an X is drawn in the grid. i only have to make the computer move but Everything seems to work OK, until last nite when I created a function CheckForMoves which returns an integer and also returns the row and column which is best move. inside the function CheckForMoves, i created a Board then i assigned it to a pointer to Board like this:
CBoard board = *pBoard;
pBoard is the Board i am using to draw my X's and O's for the game. i am copying it to a new board so i can try out all the possible moves in a new board without touching the board i am using in the game. because my board class was implemented dynamically, i wrote my own assignment operator and my own copy constructor. in my assignment operator function, i delete what ever the pointer is point to, then call new then point it to whatever is in the right of the operator. Copy constructor, because it is empty, i just point the pointers to what ever is on the right side. i went along and debugged it using the VC++ debugger then when i was walking through the code i saw that it was calling the Copy constructor. then as i walk over the Copy Constructor everything seems fine. by using asserts, if found out that all the pointers are being copied right. the cells where i store the X's and O's are copied right too. i tried using TRACE statements but i cant find the bug causing the BOARD TO BE EMPTY. i tried using MessageBox before and after calling the copy constructor. as i moved the MessageBox i saw my move X on the Board. but as soon as i clicked the MessageBox that Outputs "After" called after the copy constructor was called. the X in the board disappears. MY CONCLUSION IS THE BOARD I AM USING IN THE GAME IS BEING CHANGED SOMEHOW IN THE COPY CONSTRUCTOR. the copy constructors parameters is like this:

CBoard& CBoard::CBoard(const CBoard& Copy)

I Hope this helps explain my problem. sorry if its very long, i just want to explain it with much detail so i can tell you whats going on. Can anyone tell me whats wrong wid my program and how i can fix it? i would appreciate any method on how to find the bug. Thank you very very much.

John
GeneralRe: My Copy Constructor bug problem Pin
Paul M Watt17-Mar-02 7:39
mentorPaul M Watt17-Mar-02 7:39 
GeneralRe: My Copy Constructor bug problem Pin
John Cruz17-Mar-02 10:56
John Cruz17-Mar-02 10:56 
GeneralRe: My Copy Constructor bug problem Pin
Alexandru Savescu17-Mar-02 11:51
Alexandru Savescu17-Mar-02 11:51 
GeneralRe: My Copy Constructor bug problem Pin
John Cruz17-Mar-02 12:19
John Cruz17-Mar-02 12:19 
GeneralRe: My Copy Constructor bug problem Pin
John Cruz17-Mar-02 12:27
John Cruz17-Mar-02 12:27 
GeneralRe: My Copy Constructor bug problem Pin
Andrew Peace17-Mar-02 12:41
Andrew Peace17-Mar-02 12:41 
GeneralRe: My Copy Constructor bug problem Pin
John Cruz17-Mar-02 12:56
John Cruz17-Mar-02 12:56 
GeneralRe: My Copy Constructor bug problem Pin
Tim Smith17-Mar-02 13:14
Tim Smith17-Mar-02 13:14 
Generaldisable client-container menu.... Pin
Atila17-Mar-02 2:55
Atila17-Mar-02 2:55 
GeneralOnChar() problem ! Pin
Hadi Rezaee16-Mar-02 23:47
Hadi Rezaee16-Mar-02 23:47 
GeneralRe: OnChar() problem ! Pin
Christian Graus17-Mar-02 0:00
protectorChristian Graus17-Mar-02 0:00 
GeneralRe: OnChar() problem ! Pin
Hadi Rezaee17-Mar-02 3:10
Hadi Rezaee17-Mar-02 3:10 
GeneralHelp finding a Copy Constructor bug... Pin
John Cruz16-Mar-02 21:44
John Cruz16-Mar-02 21:44 
GeneralRe: Help finding a Copy Constructor bug... Pin
Atul Dharne17-Mar-02 18:33
Atul Dharne17-Mar-02 18:33 
QuestionHow to run FTP shell from a Win32 or C or MFC Application Pin
rodica16-Mar-02 20:51
rodica16-Mar-02 20:51 
AnswerRe: How to run FTP shell from a Win32 or C or MFC Application Pin
Philip Patrick17-Mar-02 0:43
professionalPhilip Patrick17-Mar-02 0:43 
GeneralVirtual list control Pin
Morozov Alexey16-Mar-02 19:59
Morozov Alexey16-Mar-02 19:59 

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.