gpt4 book ai didi

c++ - 子类在 ‘{’ 标记 C++ 之前需要类名

转载 作者:行者123 更新时间:2023-11-27 23:49:33 24 4
gpt4 key购买 nike

我知道有很多类似的问题,但我在这里看不到我的错误。我正在尝试继承此类:

#if !defined(__GRAPHE_H__)
#define __GRAPHE_H__

#include <queue>
#include <map>
#include <set>
#include <iostream>

using namespace std;

template <class S>
class Graphe{
public:

这里:

#if !defined(__CARTE_H__)
#define __CARTE_H__

#include <cassert>
#include <istream>
#include <list>
#include <set>
#include <string>
#include "graphe.h"
#include "pointst.h"

using namespace std;

class Carte: public Graphe
{

但我有这个错误:在“{”标记之前需要类名 {我什至没有使用父类中的任何函数,所以这就是我没有发布整个代码的原因。

我错过了什么?

最佳答案

下面的代码应该可以解决这个问题;

using namespace std;
template <class S>
class Carte: public Graphe<S>
{

关于c++ - 子类在 ‘{’ 标记 C++ 之前需要类名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47491828/

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