Compare commits
No commits in common. "e5bcc44b2ee08fa46d262973a19c0a8ad82cc8a9" and "c49545d3ff29873922e1450112b21e05010e1f1c" have entirely different histories.
e5bcc44b2e
...
c49545d3ff
@ -24,7 +24,7 @@ class Array
|
||||
|
||||
Array(const Array& src)
|
||||
{
|
||||
this->_arr = new T[0];
|
||||
new T[0];
|
||||
*this = src;
|
||||
};
|
||||
|
||||
@ -42,7 +42,6 @@ class Array
|
||||
new T[src._size];
|
||||
for (size_t i = 0; i < src._size; i++)
|
||||
this->_arr[i] = src._arr[i];
|
||||
return *this;
|
||||
};
|
||||
|
||||
T& operator[](unsigned int index) const
|
||||
|
@ -24,39 +24,14 @@ int main()
|
||||
}
|
||||
}
|
||||
|
||||
std::cout << "Fill and get" << std::endl;
|
||||
std::cout << "Fill and get";
|
||||
{
|
||||
unsigned int size = 10;
|
||||
Array<int> t(size);
|
||||
for (unsigned int i = 0; i != size; i++)
|
||||
t[i] = i;
|
||||
for (unsigned int i = 0; i != size; i++)
|
||||
std::cout << t[i] << std::endl;
|
||||
}
|
||||
std::cout << std::endl;
|
||||
|
||||
std::cout << "Copy and get" << std::endl;
|
||||
{
|
||||
unsigned int size = 10;
|
||||
Array<int> t(size);
|
||||
for (unsigned int i = 0; i != size; i++)
|
||||
t[i] = i;
|
||||
Array<int> b(t);
|
||||
for (unsigned int i = 0; i != size; i++)
|
||||
std::cout << b[i] << std::endl;
|
||||
}
|
||||
std::cout << std::endl;
|
||||
|
||||
std::cout << "operator = and get" << std::endl;
|
||||
{
|
||||
unsigned int size = 10;
|
||||
Array<int> t(size);
|
||||
for (unsigned int i = 0; i != size; i++)
|
||||
t[i] = i;
|
||||
Array<int> b;
|
||||
b = t;
|
||||
for (unsigned int i = 0; i != size; i++)
|
||||
std::cout << b[i] << std::endl;
|
||||
std::cout << i << std::endl;
|
||||
}
|
||||
std::cout << std::endl;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user