So I have a pure virtual class that needs to stay that way. In this class I have or technically need a method that takes in a templatized parameter. Here is the object type for the parameter:
template <int LENGTH>
struct MyStruct
{
int arr[LENGTH];
};
And here is my method:
template <int LENGTH>
virtual bool send_struct(const MyStruct<LENGTH>& mystruct) = 0;
However, obviously I cannot use a template with a virtual class, the alternative being adding the template to the class, which I also cannot do for my purpose. Is there an alternative to this while keeping my constraints? I need to pass array of different sizes to this method inside my pure virtual class, but I cannot templatize the class.
Aucun commentaire:
Enregistrer un commentaire