学过java的人表示太轻松了,其实就只需三个明确就能搞定函数,即明确该函数的运算结果,其实就是明确该函数的返回值类型,明确该函数的参数列表,ok,搞定!!
2016-06-17
#include <iostream>
#include <string>
using namespace std;
class Student
{
public:
string m_strName;
int m_iAge;
};
int main()
{
Student *p = new Student();
p->m_strName = "陈俊溢";
p->m_iAge = 28;
cout << p->m_strName << " " << p->m_iAge << endl;
delete p;
p = NULL;
return 0;
}
#include <string>
using namespace std;
class Student
{
public:
string m_strName;
int m_iAge;
};
int main()
{
Student *p = new Student();
p->m_strName = "陈俊溢";
p->m_iAge = 28;
cout << p->m_strName << " " << p->m_iAge << endl;
delete p;
p = NULL;
return 0;
}