Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Function Pointer in a class

Posted on 1998-11-28
5
Medium Priority
?
220 Views
Last Modified: 2011-09-20
i have a class
class myclass
{
int (*fptr)();
public:
int f1(){}
int f2(){}
};
i want the function pointer to point a member function of the class
like i would like to get
class myclass a[]={f1,f2,};
How can I do it.
0
Comment
Question by:sunild
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 11

Accepted Solution

by:
alexo earned 0 total points
ID: 1178776
int (*myclass::fptr)();

Offering 1 point marks you as a scrooge.
0
 
LVL 1

Expert Comment

by:Booth882
ID: 1178777
hear hear!
0
 

Author Comment

by:sunild
ID: 1178778
i had only 1 pt left.
Now bec's of u adding ans it's increased by 5
0
 
LVL 11

Expert Comment

by:alexo
ID: 1178779
sunild, first you have one answer.  Evaluate it, post your comments and we'll continue from there.
Second, the accepted point scale is: easy=50, medium=100, hard=200.  Single digit offerings will cause many experts to ignore your questions.  Points can be purchased.
0
 
LVL 11

Expert Comment

by:alexo
ID: 1178780
Offering 1 point (or 6 points) marks you as a scrooge.
Letting the question autograde marks you as lazy, inconsiderate and rude.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question