Yeah, the syntax is going to get messy here.
In addition to specifying which instance you're grabbing the method from, you also need to specify which instance you're _calling_ the method on. This results in some ugly syntax:
(Strip1.*(Strip1.effect_funct_array[0]))(0,0,0);
I'm getting the impression that function pointers aren't really what you want here and the solution you're looking for is probably much, much simpler.
If you give some further context, I might be able to help more. For now, I'll try to address some of the things you mentioned.
dbrenchley wrote: |
---|
Unless I'm misunderstanding instantiating different class objects would afford same functionality w/ different params concurrently .. |
Yes, sort of.
You can create different instances that may have different state, depending on how your write your classes. What you've actually described, in my opinion, is more aligned with the behaviour of methods. You could call the same method twice with different arguments, for example.
Classes are usually a little more involved. They'll typically have some internal state and model something in your program, like complex objects that cannot be represented through the fundamental data types.
'Concurrently' is a funny term here. Concurrency is a whole concept in itself in programming and I don't think this is what you're referring to. It describes code that is executed across multiple threads. For example, the following code example would not be concurrent:
1 2
|
myFirstInstance.DoStuff();
mySecondInstance.DoStuff();
|
Although these calls could occur in the same frame, they're still synchronous or serial. The first DoStuff call executes in its entirety before the second. Though this doesn't represent concurrency in the typical programming sense, I think it might be more aligned to what you're looking for. Again, further context might help here.
dbrenchley wrote: |
---|
I've been informed it's best practice for the defs in the class to be private but the compiler complains if so in this instance. |
Yes, what you're broadly describing here is the concept of encapsulation. It's often a good idea to keep class members private and expose functionality via public interfaces.
See my example in the second post. I have a vector as a private member. I cannot directly access this from outside of the class. However, I expose the limited functionality that I do want to offer via a AddFunction method. This way, I'm limiting what can be done to the class from the outside world.
There are numerous benefits to this (have a Google) but the most significant is probably the preservation of important internal state - imagine I had a method that relied on some state in the class that I made public and could be modified from anywhere. How can I reliably guarantee that the state is good and code outside the class hasn't unexpectedly meddled with it?
Hope this helps.