我试图创建一个堆栈,但即时通讯接收错误与重载my =操作符。 堆栈是类型模板。继承人代码重载操作员=错误
template <typename T>
T& ::stack& operator =(const stack& other)
{
if (this == &other) return *this;
copy(other.stack1[0], other.stack1[other.size], stack1[0]);
return *this;
}
任何帮助将不胜感激。由于
请张贴您遇到的错误。现在,我会说,返回'* this'不正确,因为'this'已经是一个指针了。 – 2014-10-05 06:38:26
什么是T&:: stack&'? – chris 2014-10-05 06:39:35
@JaviV但是操作员不会,也不应该返回一个指针。 – juanchopanza 2014-10-05 06:40:21