帮忙看看,error C2143: 语法错误 : 缺少“;”(在“using”的前面)
错误:boldparagraph.cpp(5) : error C2143: 语法错误 : 缺少“;”(在“using”的前面)
C++高级编程中的一个例子。讲装饰者模式的。其中,Paragraph是BoldParagraph的父类,父类的声明和定义都没有问题,
有问题的是子类BoldParagraph:
-----------------------------头文件中--------------------------------
// BoldParagraph.h
#pragma once
#include "Paragraph.h"
#include <string>
using namespace std;
class BoldParagraph : public Paragraph
{
public:
BoldParagraph(const Paragraph& inParagraph) : Paragraph("unassigned"), mParagraph(inParagraph){}
virtual string getText() const;
protected:
const Paragraph& mParagraph;
}
------------------------报错的CPP文件-----------------------------------
// BoldParagraph.cpp
#include "Paragraph.h"
#include "BoldParagraph.h"
#include <string>
using namespace std;
string BoldParagraph::getText() const
{
return ("<B>" + mParagraph.getText() + "</B>");
}
麻烦帮忙看看