|
-
January 14th, 2003, 06:36 PM
#1
pointer to function in another class
I have 3 classes that generate random numbers by different methods. Each of them has functions with the same name:
Init and Random.
A:Init() and A:Random()
B:Init() and B:Random()
C:Init() and C:Random()
I have another class where a calculation is performed. Depending on a local parameter (rng_type) in this class (which can be 1, 2 or 3) I would like to call:
if 1 call the A functions
if 2 call the B Functions
if 3 call the C Functions
Because the Random function will be called millions of times (!), I do not want to have to check the value of rng_type before each use.
Tried to do it with pointer to functions, but could not because the functions in the ABC classes are not static in the calculation class.
Any suggestions on how to do it would be much appreciated.
Eli
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|