I am writing a program that can take in either 3 ints, or 3 floats in the constructor(I suppose I will need 2 constructors for this). I want to declare an array and store the values in the array “numbers”.
If I don’t know which constructor will be called I am not sure how to declare “numbers”(as an int array or as a float array).
Is there a good technique to get around this? or can I create an int array and a float array and somehow have a generic pointer to the array being used(is using a void pointer the best way to do this)?
Looks like you want a templated class.