In the following code, I am creating a Vector class that inherits from the standard vector class. I am confused as to why in main, my Vector object doesn't call the derived class constructor when I include the following line
using vector<T>::vector;
but when I don't include it, it calls my derived class constructor as expected. What is the reason for this? I haven't been able to replicate the problem with toy code, so that would be very much appreciated.
#include <iostream>
#include <vector>
using namespace std;
template <class T>
class Vector : public vector<T>
{
vector <T> x;
//using vector<T>::vector;
public:
Vector(vector <T> x)
{
this->x = x;
for (auto i: this->x)
cout << i << " ";
}
};
int main() {
Vector <int> x({1,2,3,4,5});
return 0;
}