template<typename T>
class nodAB : public arbBinar<T>
{
private:
T info;
nodAB<T> *tata;
nodAB<T> *st;
nodAB<T> *dr;
public:
nodAB(const T& x):info(x),tata(0),st(0),dr(0){};
nodAB(const T& x, nodAB<T> *t):info(x),tata(t),st(0),dr(0){};
virtual nodAB<T>* copiaza();
virtual nodAB<T>*insereaza (T& item);
virtual void parcurge_invers();
void setInfo(T& x) {info =x;}
void setTata(nodAB<T> *t) {tata=t;}
void setStang(nodAB<T> *stang) {st=stang;}
void setDrept(nodAB<T> *drept) {dr=drept;}
T getInfo() const {return info;}
nodAB<T> *getStang() const {return st;}
nodAB<T> *getDrept() const {return dr;}
nodAB<T> *getTata() const {return tata;}
bool esteRadacina()const
{
return tata==NULL;
}
bool esteFrunza()const
{
return (st==NULL && dr==NULL);
}
bool esteFiuStang()const
{
return tata!=NULL && tata->getStang()==this;
}
bool esteFiuDrept()const
{
return tata!=NULL && tata->getDrept()==this;
}
~nodAB();
};
我的問題是爲什麼在class nodAB: public arbBinar<T> {
Visual Studio給我一個語法錯誤?爲什麼Visual Studio 2010會爲此代碼提供語法錯誤?
template<typename T>
class arbBinar{
protected:
nodAB<T> *radacina;
public:
arbBinar():radacina(0){}
arbBinar(nodAB<T> *rad) {radacina=rad;}
nodAB<T> *getRadacina(){return radacina;}
~arbBinar();
};
它究竟說什麼?哪條線?什麼是'arbBinar'?它在哪裏宣佈? –
AnT
錯誤錯誤C2143:語法錯誤:缺少前 '' '<' \t C:\用戶\安德烈\桌面\ SDA項目\ SDA \ SDA \ nodab.h SDA – bngandrei
模板 類arbBinar { protected: \t nodAB * radacina; 公共: \t arbBinar():radacina(0){} \t arbBinar(nodAB *弧度){radacina =弧度;} \t nodAB * getRadacina(){返回radacina;} \t〜arbBinar(); }; –
bngandrei