-
November 23rd, 2009, 10:43 AM
#1
[RESOLVED] Pass a class as an argument in a member function
I have a class called player and the member function move. In move, there is a function that needs the player as an argument. How can I pass the player itself as an argument to the function???
-
November 23rd, 2009, 10:46 AM
#2
Re: Pass a class as an argument in a member function
Sounds like you want to pass an object of the player class as an argument.
-
November 23rd, 2009, 10:48 AM
#3
Re: Pass a class as an argument in a member function
-
November 23rd, 2009, 10:49 AM
#4
Re: Pass a class as an argument in a member function
assuming the function is setup for that, you can use the this keyword or *this
0100 0111 0110 1111 0110 0100 0010 0000 0110 1001 0111 0011 0010 0000 0110 0110 0110 1111 0111 0010
0110 0101 0111 0110 0110 0101 0111 0010 0010 0001 0010 0001 0000 0000 0000 0000 0000 0000 0000 0000
-
November 23rd, 2009, 10:55 AM
#5
Re: Pass a class as an argument in a member function
Thanks Joeman, th is exactly what I wanted
-
November 23rd, 2009, 04:08 PM
#6
Re: Pass a class as an argument in a member function
Is move static? Why else would an object need to pass the this pointer to one of its own member functions?
-
November 28th, 2009, 06:38 AM
#7
Re: Pass a class as an argument in a member function
It was passing it to an outside function via the member function, but the issue is solved now.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|