Hello,
I have these two classes
-------------------------------------------------
template<typename T> class X
{
public:
X(string A, T B); //constructor
.
.
.
};
--------------------------------------------------
#include "X.h"
template<typename T> class Y
{
public:
vector< X<T>* > VecX;
.
.
.
};
-------------------------------------------------
I want to add a cell to the vector VecX by push_back and keep in it a pointer to new object X, however I keep getting errors, I tried doing it like this:
Hello,
where exactly are you trying to push_back() ? How are A and B defined? Why do you call the constructor of X explicitly? At a first glance, the call doesn't look too bad...
in a function belongs to Class Y, and its in public
How are A and B defined?
A is a string, B will be defined during runtime, and it can be unsigned or double.
Why do you call the constructor of X explicitly
At some point, regarding the user commands, I may have to build new object X (dynamically), so I'll push to the vector (which contains pointers to X) a new object which the constructor will build