Solved

Function Pointer in a class

Posted on 1998-11-28
5
174 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
  • 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

705 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now