Running functions from pointers

A

ADT_CLONE

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top