so lets say we have some inheritance going on…think item hierarchy
class parent {
int a;
}
class child extends parent {
int b;
}
We make a List and start placing type child in the List. int b is sliced and you cannot access List*.b unless you first assign it to a new var of type child.*
This has caused a huge problem for me. I designed an entire inventory system through loop holes around this slicing problem, and I have hit a brick wall where the loop holes are becoming such a hassle that I might as well ditch polymorphism entirely and just make every item essentially the same.
I might potentially have 200+ spawnable lootable items in the game I am working on, and coding 200 cases for every potential item use is insanely inefficient and cumbersome for both coding and future content addition.
So what are my options guys?