C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Running functions from pointers

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
ADT_CLONE
Guest





PostPosted: Sun Oct 15, 2006 7:25 am    Post subject: Running functions from pointers Reply with quote



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





PostPosted: Sun Oct 15, 2006 7:49 am    Post subject: Re: Running functions from pointers Reply with quote



* 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
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.