int main(int argc, const char * argv[]) { People *p = new People(); p->sayHello(); delete p; return 0; }
int main(int argc, const char * argv[]) { // insert code here... People *p =new People(); p->sayHello(); delete p; return 0; }
int main() { People *p = PeopleInit(ObjectCreate(People),20); p->sayHello(); ObjectDelete(p); return 0; }
int main(int argc, const char * argv[]) { // insert code here... People *p =new People( ); p->sayHello(); // std::cout << "Hello, World!\n"; delete p; return 0; }
int main(int argc, const char * argv[]) { // 用命名空间方式来访问类 // jikexueyuan:命名空间 // jikexueyuan::People *p = new jikexueyuan::People(); People *p = new People(); p->sayHello(); //销毁对象 delete p; return 0; }
int main(int argc, const char * argv[]) { //类对象 People *p = new People(); //类方法 p->sayHello(); //销毁对象 delete p; //C语言的分配内存和销毁内存的关键字 //malloc(sizi_t) //free(void *) return 0; }
int main(int argc, const char * argv[]) { People *p = new Man(20); //People *p = new People(20,1); // Let father point to sun's shili. // Use the point to call the function with the // same name in father's p->sayHello(); p->eat(); return 0; }
int main(int argc, const char * argv[]) { // People * p = new People(); // p->sayHello(); // delete p; People* m = new Man(20); m->sayHello(); m->eat(); printf("age : %d\n",m->getAge()); delete m; std::cout << "Hello, World!\n"; return 0; }