level 11
gameloftyou
楼主
代码:
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
class Example
{
string name;
public:
Example(string sname)
{
name = sname;
}
string getName() const
{
return name;
}
};
int main()
{
Example exa("Jim");
cout<<exa.getName()<<endl;
//这一句exa.getName()编译时能不能内联展开,用exa.name肯定不行,还是说类里面的内联函数只在类内部调用时才展开
system("pause");
return 0;
}
2012年07月27日 12点07分
1
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
class Example
{
string name;
public:
Example(string sname)
{
name = sname;
}
string getName() const
{
return name;
}
};
int main()
{
Example exa("Jim");
cout<<exa.getName()<<endl;
//这一句exa.getName()编译时能不能内联展开,用exa.name肯定不行,还是说类里面的内联函数只在类内部调用时才展开
system("pause");
return 0;
}