dFx Thank you for your reply, that could be a solution for the problem but imagine if you had 50 different objects. My goal is to store different data types.
e.kislov Thank you for the link, It helped a lot. But sadly as SGronchi mentioned the array would only store references to them. I will look into dynamic memory allocation and see if I can manage to resolve this.
Thanks once again everybody for the help!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
Is it possible to store different data types in an array if they implement the same interface?
Or in any other way...?
Could this be achieved using a union datatype of A and B ?
I think, you should use ARRAY [0..5] OF MyInterface
Check this:
https://industry.plantautomation-techno ... xperts.pdf m
The array would not store objects, just "references" to them. You need to provide storage outside the array (or you go by dynamic memory allocation).
dFx Thank you for your reply, that could be a solution for the problem but imagine if you had 50 different objects. My goal is to store different data types.
e.kislov Thank you for the link, It helped a lot. But sadly as SGronchi mentioned the array would only store references to them. I will look into dynamic memory allocation and see if I can manage to resolve this.
Thanks once again everybody for the help!