求救·

suixinpiaodang 2011-05-21 11:19:19
我见了一个工程

quad.h
#ifndef _QUADRANGLE_H_//基类
#define _QUADRANGLE_H_
#include<iostream>
#include<string>
using namespace std;
class Quadrangle
{
public:
string name; //形体标识
double s;
string what();
void draw();
double area();//计算面积
private:
int width,length;
};
typedef Quadrangle *QUADPTR;

#endif




让后在此基础上继承了一个类
rect.h

#ifndef _RECT_H_
#define _RECT_H_
#include<iostream>
#include<string>
#include"quad.h"
using namespace std;
class Rectangle:public Parallelogram
{
public:
Rectangle (int w = 5, int h = 7);
~Rectangle();
string what();
double area();
void draw ();

private:
int width, height; //

};
#endif

这个错误是什么?

3\shiyan3\rect.h|8|error: expected class-name before '{' token|
3||=== Build finished: 2 errors, 0 warnings ===|
...全文
62 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
suixinpiaodang 2011-05-23
  • 打赏
  • 举报
回复
谢谢各位 好低级的一个错误
cbib_cat 2011-05-21
  • 打赏
  • 举报
回复
把类的头文件加进来。
newfarmerchi 2011-05-21
  • 打赏
  • 举报
回复
class Rectangle:public Parallelogram
or---?
class Rectangle:public Quadrangle
  • 打赏
  • 举报
回复
从你现在给出的信息没找到原因,可能是你用了中文字符所致

还有那个Parallelogram 有木问题
downmooner 2011-05-21
  • 打赏
  • 举报
回复
class Rectangle:public Parallelogram 应该是Quadrangle

64,635

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧