C++-day7作业

#include 
#define MAX 40

using namespace std;

template
class MyVector
{
private:
    T *data;
    int len;
    int csize;
public:
    //无参构造
    MyVector():len(0),csize(0)
    {
        data=new T[len];
    }

    //有参构造
    MyVector(int l,T d)
    {
        data=new T[l];
        for(int i=0;i m1;
    MyVector m2(5,6);
    
    m2.push_back(9);
    m2.push_back(5);
    m2.push_back(2);
    m2.push_back(7);
    
    cout<

你可能感兴趣的:(c++,开发语言)