//---------------------------------------------------------------------------
#include<iostream.h>
#include <vcl.h>
#pragma hdrstop
//---------------------------------------------------------------------------
#pragma argsused
class simplecat
{
public:
simplecat();
simplecat(simplecat&);
~simplecat();
int getage() const {return itsage;}
int setage(int age){itsage=age;}
private:
int itsage;
};
simplecat::simplecat()
{
cout<<"simple cat constructor..."<<endl;
itsage=1;
}
simplecat::simplecat(simplecat&)
{
cout<<"simple cat copy constructor..."<<endl;
}
simplecat::~simplecat()
{
cout<<"simple cat destructor..."<<endl;
}
const simplecat * const functiontwo(const simplecat *const thecat);
int main(int argc, char* argv[])
{
cout<<"making a cat..."<<endl;
simplecat frisky;
cout<<"frisky is";
cout<<frisky.getage();
cout<<"years old"<<endl;
int age=5;
frisky.setage(age);
cout<<"frisky is";
cout<<frisky.getage();
cout<<"years old"<<endl;
cout<<"calling functiontwo.... "<<endl;
functiontwo(&frisky);
cout<<"frisky is";
cout<<frisky.getage();
cout<<"years old"<<endl;
char response;
cin>>response;
return 0;
}
const simplecat *const functiontwo(const simplecat *const thecat)
{
cout<<"function two.returning..."<<endl;
cout<<"frisky is now"<<thecat->getage();
cout<<"years old"<<endl;
thecat->setage(8);
return thecat;
}
//---------------------------------------------------------------------------
蓝色那一行代码是什么意思??为什么函数前面要*??
那位高手给解释下,谢谢!!