By three today I need this problem solved!
For a class I''m suppost to write a program with a class set up like this\
class machine{
typedef void (machine::*fnctptr)();
fnctptr parcerarray[commands];
//all other crap I don''t feel like writing
};
Now I''m suppost to access an element of the array in a method of the class
this->*(parcerarray)();//I get identifier error,also how teach told me to do it.
parcerarray();//I get non-function error
machine::parcerarray();//same as above, I tried all arrangments of typecasting
</source>
What do I do? </i>
NEED HELP FAST!!!!!!!
a.h{text-decoration:none;color:blue;};a.h:hover{text-decoration:underline;background:red;};
Why is it called a hot water heater? Isn't it cold when it goes in the tank?
[email=jtaylor@gtemail.net" class="h]-=CF=-[/email]
Here''s what you do:
Don''t post your homework questions to the GAMEDEV site!
I think that''ll solve ALL of our problems, gimps!
VyvyanBasterd
Don''t post your homework questions to the GAMEDEV site!
I think that''ll solve ALL of our problems, gimps!
VyvyanBasterd
Allright,
I''ve seen plenty of homework posts in this forum, especialy higher levels. I asked this question because I had exausted all of my resorces and I figured I might give this place a try. I worked on it for three days with no avail. I feel you post was in bad taste. If you felt like this post needed no answer then you shouldn''t have answered it.
a.h{text-decoration:none;color:blue;};a.h:hover{text-decoration:underline;background:red;};
I''ve seen plenty of homework posts in this forum, especialy higher levels. I asked this question because I had exausted all of my resorces and I figured I might give this place a try. I worked on it for three days with no avail. I feel you post was in bad taste. If you felt like this post needed no answer then you shouldn''t have answered it.
a.h{text-decoration:none;color:blue;};a.h:hover{text-decoration:underline;background:red;};
Snootchie Bootchies!
-=CF=-
a.h{text-decoration:none;color:blue;};a.h:hover{text-decoration:underline;background:red;};
Why is it called a hot water heater? Isn't it cold when it goes in the tank?
[email=jtaylor@gtemail.net" class="h]-=CF=-[/email]
...And if you have the stupid idea to post your homework questions, please don''t give your threads such a ultra stupid name. I suggest that people just ignore those dumb posts
Tim
--------------------------
glvelocity.gamedev.net
www.gamedev.net/hosted/glvelocity
Tim
--------------------------
glvelocity.gamedev.net
www.gamedev.net/hosted/glvelocity
Tim--------------------------glvelocity.gamedev.netwww.gamedev.net/hosted/glvelocity
If you''re going to post a question from homework, don''t tell anyone it''s homework! Come on. Get it right next time!
Alex
Alex
Alexbigshot@austin.rr.comFoolish man give wife grand piano. Wise man give wife upright organ.
is this a trick question?
Edited by - Fragmo on September 28, 2000 9:16:00 PM
Edited by - Fragmo on September 28, 2000 9:16:00 PM
i''m not gonna do your homework for you.. if you can''t do it yourself, talk to your professor or TA.. i got it to work, though, with one change.. you probably think i''m an asshole for not telling you, but sorry, i don''t screw with academic dishonesty.. i recommend going to see your professor (or a TA if the profs not available)... are you sure you got all the syntax there right?
------------------------
IUnknown *pUnkOuter
------------------------
IUnknown *pUnkOuter
------------------------IUnknown *pUnkOuter"Try the best you cantry the best you canthe best you can is good enough" --Radiohead
September 29, 2000 08:37 AM
I think people read this forum to help each other in order to get help when they need it... Why do you shout at this guy? He only needs a hint. If I would know the answer to his question I would help him of course. No matter wheter it is his homework or not.
''Do it by yourself'' could be an answer for EVERY question on this board.
Just my 2 cents...
''Do it by yourself'' could be an answer for EVERY question on this board.
Just my 2 cents...
Y''know,
I wasn''t going to respond to this thread anymore, but I feel now that there needs some clarification. I WAS NOT ASKING FOR SOMEONE TO DO MY PROBLEM! In no way did I imply that. All I asked for was the proper syntax for a member function pointer. I used the syntax the profesor gave out in class, to the letter, and it didn''t work. The part of the program that I posted was about .5% of the entire thing. It wasn''t even apart of the lesson. I take my schooling very seriously, and in no way do I feel I was being dishonest! I was asking a community who would have more experiance with various compilers. That''s all the issue was, different compilers! I have seen people post homework questions on how to write a program that generates it''s own code, and plenty more. My demands were alot simpler. Flaming on lame titles for threads, fine, I''ll take that. Academic dishonesty, that I will not tolerate.
I wasn''t going to respond to this thread anymore, but I feel now that there needs some clarification. I WAS NOT ASKING FOR SOMEONE TO DO MY PROBLEM! In no way did I imply that. All I asked for was the proper syntax for a member function pointer. I used the syntax the profesor gave out in class, to the letter, and it didn''t work. The part of the program that I posted was about .5% of the entire thing. It wasn''t even apart of the lesson. I take my schooling very seriously, and in no way do I feel I was being dishonest! I was asking a community who would have more experiance with various compilers. That''s all the issue was, different compilers! I have seen people post homework questions on how to write a program that generates it''s own code, and plenty more. My demands were alot simpler. Flaming on lame titles for threads, fine, I''ll take that. Academic dishonesty, that I will not tolerate.
a.h{text-decoration:none;color:blue;};a.h:hover{text-decoration:underline;background:red;};
Why is it called a hot water heater? Isn't it cold when it goes in the tank?
[email=jtaylor@gtemail.net" class="h]-=CF=-[/email]
Well, it''s after 3, but I''ll answer anyway First thing I would have done in your place would be to check the book or ask the teacher, but... In section 15.5 of Stroudstrup''s "The C++ Programming Language" he explains the use of function pointers thus:
This should be enough to go on. You didn''t provide enough information for a directly applicable example but you should be able to see that you did have it slightly wrong (and I suspect that either you weren''t doing it exactly as the teacher had shown you or he screwed up when giving the example).
class Std_interface{ virtual void start() = 0; virtual void suspend() = 0; // more virtual functions}; typedef void (Std_interface::*Pstd_mem)(); void f( Std_interface* p ){ Pstd_mem s = &Std_interface::suspend; p->suspend(); // direct call (p->*s)(); // call through pointer to member}
This should be enough to go on. You didn''t provide enough information for a directly applicable example but you should be able to see that you did have it slightly wrong (and I suspect that either you weren''t doing it exactly as the teacher had shown you or he screwed up when giving the example).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement