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

C / C++ / MFC

 
QuestionHow do I determine mouse cursor size? Pin
13-Nov-00 5:37
suss13-Nov-00 5:37 
AnswerRe: How do I determine mouse cursor size? Pin
14-Nov-00 5:19
suss14-Nov-00 5:19 
GeneralProblem to launch WIN NT 'Net Send' programatically Pin
13-Nov-00 4:14
suss13-Nov-00 4:14 
GeneralWeird DAO Problems Pin
13-Nov-00 1:11
suss13-Nov-00 1:11 
GeneralCString in non-MFC application Pin
12-Nov-00 17:58
suss12-Nov-00 17:58 
GeneralRe: CString in non-MFC application Pin
Uwe Keim12-Nov-00 19:23
sitebuilderUwe Keim12-Nov-00 19:23 
GeneralDirectX problem Pin
rtortora12-Nov-00 11:12
rtortora12-Nov-00 11:12 
GeneralPassing Class Pointers Pin
12-Nov-00 9:59
suss12-Nov-00 9:59 
Here is the deal:
I have declared a class object in a function. Then I created a pointer to it right afterwords in the same function. Here is where the problem is. I try to pass that pointer to another function, and i get no errors, yet when i try to look at a data member of the class, i get all kinds of errors. Could someone tell me if this syntax for passing class pointers is correct?
(The class name is army and the object is MyArmy and the pointer to MyArmy is pMyArmy)
Pointer is declared like this:

void make_faction()
{
//creates object
army MyArmy(75, 5, 3000, 5);

//Creates a pointer to army
army* pMyArmy = 0;

//Gives the address
pMyArmy = &MyArmy;

//calling function
game_menu(pMyArmy);
}

Recieving function:
int game_menu(class army *pMyArmy)
{
return 0;
}

Is this the correct syntax? It shows no errors this way, but when i add

cout << pMyArmy->troops << endl;

to game_menu function, get errors.
GeneralRe: Passing Class Pointers Pin
12-Nov-00 18:19
suss12-Nov-00 18:19 
GeneralRe: Passing Class Pointers Pin
12-Nov-00 19:28
suss12-Nov-00 19:28 
GeneralCapturing whole Form View Pin
Suha Aktan12-Nov-00 9:03
Suha Aktan12-Nov-00 9:03 
GeneralRe: Capturing whole Form View Pin
12-Nov-00 12:48
suss12-Nov-00 12:48 
GeneralCalling C++ functions from C code Pin
David Wulff11-Nov-00 13:35
David Wulff11-Nov-00 13:35 
GeneralOffice 2000 Gui font Pin
Joel Holdsworth11-Nov-00 10:16
Joel Holdsworth11-Nov-00 10:16 
GeneralRe: Office 2000 Gui font Pin
David Wulff11-Nov-00 13:37
David Wulff11-Nov-00 13:37 
GeneralRe: Office 2000 Gui font Pin
Uwe Keim12-Nov-00 19:25
sitebuilderUwe Keim12-Nov-00 19:25 
GeneralRe: Office 2000 Gui font Pin
David Wulff13-Nov-00 6:18
David Wulff13-Nov-00 6:18 
GeneralRe: Office 2000 Gui font Pin
Michael Dunn13-Nov-00 7:11
sitebuilderMichael Dunn13-Nov-00 7:11 
GeneralRe: Office 2000 Gui font Pin
13-Nov-00 7:16
suss13-Nov-00 7:16 
GeneralExport a function from a dll Pin
11-Nov-00 7:13
suss11-Nov-00 7:13 
GeneralRe: Export a function from a dll Pin
Michael Dunn11-Nov-00 8:26
sitebuilderMichael Dunn11-Nov-00 8:26 
QuestionCreating self-extracting executables? Pin
Erik11-Nov-00 3:42
Erik11-Nov-00 3:42 
GeneralUsing MSFlexGrid as CView in SDI Pin
Suha Aktan11-Nov-00 3:13
Suha Aktan11-Nov-00 3:13 
GeneralRe: Using MSFlexGrid as CView in SDI Pin
Christian Graus11-Nov-00 12:19
protectorChristian Graus11-Nov-00 12:19 
GeneralHow about printing it? Pin
Suha Aktan12-Nov-00 6:40
Suha Aktan12-Nov-00 6:40 

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.