gpt4 book ai didi

c++ - 尝试编写一个纯虚方法,但我的语法显然有误?

转载 作者:太空宇宙 更新时间:2023-11-04 16:18:14 25 4
gpt4 key购买 nike

这是我的代码:

#include <string>
#include <complex>

class a{
protected:
std::string name;

public:
a(std::string _name): name(_name) {};

virtual void inside(const complex<double> &b, const complex<double> &t) const = 0;
};

但是 visual studio 在我声明虚拟方法的行中给出了这些错误:

Error   1   error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Error 2 error C2143: syntax error : missing ',' before '<'

我看不出我做错了什么。

最佳答案

类似于您之前的 std::string name;,模板 complex 被正确地称为 std::complex

关于c++ - 尝试编写一个纯虚方法,但我的语法显然有误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20156766/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com