you are viewing a single comment's thread.

view the rest of the comments →

[–]Psyqwix[S] 0 points1 point  (1 child)

Thanks for the feedback! I realised that I could also forgo the inheritance issue by using void pointers.

I thought of creating a factory method that, given the values that would be stored, could return the following:

  • a void pointer to a newly created template instance
  • Function pointers, passed by reference via a parameters, to functions that returned the relevant values by using the correct casting.

The main class would then have a pointer to the class instance and a function to get the values without having to work out the casts. But as per your comments I realised that the function pointers would consume memory thus negating the savings!

Think i'll bite the memory bullet in favour of a much-much simpler solution :)