#include <iostream>
#include <string>
using std::cout;
using std::endl;
namespace Student {
public:
int m_strName;
int m_iAge;
};
int main(void) {
Student stu;
stu.m_strName = "imooc";
stu.m_iAge = 2;
cout << stu.m_strName << " " << stu.m_iAge << endl;
return 0;
}
#include <string>
using std::cout;
using std::endl;
namespace Student {
public:
int m_strName;
int m_iAge;
};
int main(void) {
Student stu;
stu.m_strName = "imooc";
stu.m_iAge = 2;
cout << stu.m_strName << " " << stu.m_iAge << endl;
return 0;
}
public:
void setName(string _name)
{m_strName = _name;}
string getName()
{return m_strName;}
private:
string m_strName;
};
int main()
{ Student *str = new Student();
str->setName("慕課網");
cout << str->getName() <<endl;
delete str;
str = NULL;
return 0;}
void setName(string _name)
{m_strName = _name;}
string getName()
{return m_strName;}
private:
string m_strName;
};
int main()
{ Student *str = new Student();
str->setName("慕課網");
cout << str->getName() <<endl;
delete str;
str = NULL;
return 0;}