I have a linked list of type Device:
Node<Device> list = new Node<device>(device);
And Device have derived classes:
And I need my list to be able to hold every derived class of Device.
How can I do it?
Note: If I send an Aerobic_Device to the list, it just dynamically converts to Device, which loses data.
EDIT:
I changed all the logic of my program to work with pointers, and now the list is: Node<Device*>
- Which still converts everything to Device type.
Now, as many suggested, I switched it to Node<std::unique_ptr<Device>>
, but this just introduced many many many errors.