【问题标题】:Issue with Overloading the Assignment Operator in C++ [closed]在 C++ 中重载赋值运算符的问题 [关闭]
【发布时间】:2013-09-08 15:20:27
【问题描述】:

我正在尝试重载赋值运算符,并不断收到以下错误:

StackLinked& operator=(const StackLinked& other);

template<typename DataType>
StackLinked<DataType> StackLinked<DataType>::StackLinked& operator=(const StackLinked& other)

错误:警告 C4346:“StackLinked::{ctor}”:依赖名称不是类型

知道如何解决这个问题吗?我无法编辑标题部分,只能编辑实现。

【问题讨论】:

  • 显示足够多的类定义,我们可以看到第一行在 inside 它,它是一个模板。

标签: c++ overloading


【解决方案1】:
template<typename DataType>
StackLinked<DataType>& StackLinked<DataType>::operator=(const StackLinked& other)

【讨论】:

    猜你喜欢
    • 2014-10-16
    • 2011-03-06
    • 1970-01-01
    • 2019-08-09
    • 2012-08-17
    • 2013-03-30
    • 2016-08-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多