jeudi 3 mai 2018

How to create a class which inheritates from std::vector (C++)

I need to heritage all functions from std::vector and I want to overload operators to make a complete matrix class Can you help me a bit, there is not too much information about this topic and I am practising my english.(Sorry my english)

Matriz.h

#include <vector>
#include <iostream>
using namespace std;

template<typename T>
class Matriz:vector<T>
{
public:
    using vector<T>::vector;

private:
}

Matriz.cpp

int main(){

    Matriz<int> dani = { 2,2 };
}

When I want to initialize it, I got an error.

Error C2371 'dani': redefinition; different basic types Matriz

Aucun commentaire:

Enregistrer un commentaire