public
private
protected
delete
const
static
strlen
strcpy
operater
virtual
template
“=”“[]”“()”“->”必须非静态成员函数
. .* :: ?: 不可重载
重载运算符:
Person operator+(const Person& p)
ostream& operator <<(ostream& out,Person& p)
MyInteger& operator++()
MyInteger operator++(int)
Person& operater=(Person& p)
bool operater==(Person& p)
char *p="25425423553";
t=new char[strlen(p)+1];
strcpy(t,p);
delete [] t;
//用字符串初始化字符串时,系统会在字符串的末尾自动加上一个字符"\0",因此数组的大小比字符串中实际字符的个数大。如:sizeof(str1)=strlen(str1) +1;
// sizeof会计入‘\0’,strlen不会//
Date(const Date &d)
{
this->year = d.year;
this->month = d.month;
this->day = d.day;
}//拷贝构造
class CD
{
char name[20];
int number;
public:
void init(char* aa, int bb)
{
// ERROR **********found**********
name=aa;//strcpy(name,aa);
number=bb;
}
cout<< name <<' '<< number <<endl; //name