Hello, I want to conjunction two vectors, but when I try to write result on the screen I get result without int number, which is in Two<T>. I want to get result: one two three four 50
Can you help me, how to fix it? Thank you :)
Ah, I missed that. x is storing objects of type One<string> and can't store objects of any other type. What happens when you try to add a Two<string> object to x is called slicing. Only the One<string> part of the Two<string> object will be copied and inserted into x.
A One<string> pointer can point to a One<string> object or to a Two<string> object, so if you have a vector of One<string> pointers (or smart pointers) you can store pointers to both types in the same vector. That is probably what you'll have to do.