 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
ADT_CLONE Guest
|
Posted: Sun Oct 15, 2006 7:25 am Post subject: Running functions from pointers |
|
|
I am having troubles figuring out how to run a function from a pointer
to a class. Here is the code:
Map *m=Global::Maps[0];
Model *mo=m.getModel(0);
Global::Maps[0] is a pointer to a map and the Maps[] array's type is
*Map.
getModel(index) returns a pointer to a model at index in the *Model
array. Anyway, you can see what I'm trying to do. I'm trying to run a
function using a pointer. Now I know right now my syntax is really
wrong, because address_to_pointer.getModel(0) won't work. Though what I
want to do is make it so that I can do something like this:
Model.getModel(0)
Though how would I dereference the mo pointer to run the function? I've
tried using -> but I get this error:
505 C:\Documents and Settings\Owner\Desktop\Easy
Engine\CodeFile\Input.cpp invalid use of undefined type `struct Map'
By using the way above I get this error:
505 C:\Documents and Settings\Owner\Desktop\Easy
Engine\CodeFile\Input.cpp `getModel' has not been declared
Any help on this problem would be greatly appriciated.
ADT_CLONE |
|
| Back to top |
|
 |
Alf P. Steinbach Guest
|
Posted: Sun Oct 15, 2006 7:49 am Post subject: Re: Running functions from pointers |
|
|
* ADT_CLONE:
| Quote: |
Any help on this problem would be greatly appriciated.
|
See the FAQ on how to post a question about code that doesn't work.
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail? |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|