示例#1
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;
}
示例#2
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;
}