Click here to Skip to main content
15,913,722 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: 2. Questions about PowerDown and Hibernation - need help Pin
Stephen Hewitt12-Feb-08 15:04
Stephen Hewitt12-Feb-08 15:04 
GeneralRe: 2. Questions about PowerDown and Hibernation - need help Pin
tibiz13-Feb-08 0:11
tibiz13-Feb-08 0:11 
GeneralRe: 2. Questions about PowerDown and Hibernation - need help Pin
Stephen Hewitt13-Feb-08 1:06
Stephen Hewitt13-Feb-08 1:06 
GeneralRe: 2. Questions about PowerDown and Hibernation - need help Pin
tibiz13-Feb-08 5:51
tibiz13-Feb-08 5:51 
GeneralProblems distributing release version Pin
Tom Paronis12-Feb-08 12:54
Tom Paronis12-Feb-08 12:54 
GeneralRe: Problems distributing release version Pin
Cedric Moonen12-Feb-08 20:29
Cedric Moonen12-Feb-08 20:29 
GeneralRe: Problems distributing release version Pin
Tom Paronis13-Feb-08 9:49
Tom Paronis13-Feb-08 9:49 
Generalint * -vs- Object * Pin
Areal Person12-Feb-08 11:44
Areal Person12-Feb-08 11:44 
How come I can work with int *, but it does not work the same for
Object ptr's

This code works, but just try changing the int to a class object
and NOTHING will work. Note: Object test code is not listed cause it dont work!

I'm trying to learn to work with class pointers, but I can't get anything to work

Thanks - Areal
********************************************* the code
// A simple class for testing pointers
class Object {
int id;
public:

Object() {};
~Object() {};
void setid(int _id) { id = _id;}
int getid() { return this->;id; }
};

int * foo( int * addr);
Object * foo( Object * addr);

int main(int argc, char* argv[])
{

// These are the test subjects
Object o, obj1;
int a;
// end area


// General pointers for both test cases
Object *op;
int *p;
int *swap_addr;
Object *op_swap_addr;
// end area

// just initilize pointers
swap_addr=0;
p=0;
// end area

// Now set int/Object variables for testing
a = 10;
o.setid(999);
// end area

// Pointer assignment for int a
p=&a;
// end area

// Now run the test for the integer variable sending the pointer through foo
cout << "Value of a is ... " << a << endl;
cout << "Value of p is ... " << p << endl;
cout << "Value of *p is ... " <<*p << endl;

swap_addr = foo (p);

cout << "Value of swap_addr comming from foo is ... " << swap_addr << endl;
cout << "Value of *swap_addr comming from foo is ... " <<*swap_addr << endl;

// END FIRST AREA TEST PASSED


return 0;
}

int * foo( int * addr)
{

cout << "Value of addr in foo is ... " << addr << endl;

return addr;
}
// Object
Object * foo( Object * addr)
{

cout << "Value of addr in foo is ... "<< addr << endl;

return addr;
}
GeneralRe: int * -vs- Object * Pin
Mark Salsbery12-Feb-08 12:34
Mark Salsbery12-Feb-08 12:34 
GeneralRe: int * -vs- Object * Pin
CPallini12-Feb-08 21:29
mveCPallini12-Feb-08 21:29 
GeneralRe: int * -vs- Object * Pin
Areal Person13-Feb-08 4:57
Areal Person13-Feb-08 4:57 
GeneralRe: int * -vs- Object * Pin
Mark Salsbery13-Feb-08 8:16
Mark Salsbery13-Feb-08 8:16 
GeneralConnecting to another computer on the internet (i.e. remotely) Pin
Member 26088012-Feb-08 11:10
Member 26088012-Feb-08 11:10 
GeneralRe: Connecting to another computer on the internet (i.e. remotely) Pin
Mark Salsbery12-Feb-08 12:38
Mark Salsbery12-Feb-08 12:38 
GeneralRe: Connecting to another computer on the internet (i.e. remotely) Pin
Member 26088012-Feb-08 12:59
Member 26088012-Feb-08 12:59 
GeneralRe: Connecting to another computer on the internet (i.e. remotely) Pin
Mark Salsbery12-Feb-08 13:08
Mark Salsbery12-Feb-08 13:08 
GeneralRe: Connecting to another computer on the internet (i.e. remotely) Pin
Member 26088013-Feb-08 18:14
Member 26088013-Feb-08 18:14 
GeneralRe: Connecting to another computer on the internet (i.e. remotely) Pin
Mark Salsbery13-Feb-08 19:37
Mark Salsbery13-Feb-08 19:37 
GeneralRe: Connecting to another computer on the internet (i.e. remotely) Pin
Member 26088014-Feb-08 2:16
Member 26088014-Feb-08 2:16 
GeneralRe: Connecting to another computer on the internet (i.e. remotely) Pin
Member 26088014-Feb-08 3:05
Member 26088014-Feb-08 3:05 
GeneralRe: Connecting to another computer on the internet (i.e. remotely) Pin
Mark Salsbery14-Feb-08 6:26
Mark Salsbery14-Feb-08 6:26 
GeneralRe: Connecting to another computer on the internet (i.e. remotely) Pin
Mark Salsbery12-Feb-08 13:13
Mark Salsbery12-Feb-08 13:13 
QuestionRe: Connecting to another computer on the internet (i.e. remotely) Pin
David Crow13-Feb-08 3:34
David Crow13-Feb-08 3:34 
GeneralRe: Connecting to another computer on the internet (i.e. remotely) Pin
Member 26088014-Feb-08 3:08
Member 26088014-Feb-08 3:08 
GeneralRe: Connecting to another computer on the internet (i.e. remotely) Pin
David Crow14-Feb-08 4:58
David Crow14-Feb-08 4:58 

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.