I am currently struggling with references and smart pointers with c++, this is my class layout (Everything is child of abstract A)
A
+-B
+-C
+-D
What i want is when I call B().foo(C()) is to add shared pointer of C() to vector> inside of B. and the same for B().foo(D()) however when I call
void foo(const A& item){
container.push_back(make_shared<A>(item);
}
it seems to strip all non A attributes from item (although function item.bar() still calls overloaded function in item)
it might be that I completely miss the point here, but that is where I am stuck right now