Loading

c++ 的 static_cast

http://www.cnblogs.com/pigerhan/archive/2013/02/26/2933590.html

 

#include "Person.h"
#include <string>
#include <iostream>

Person::Person()
{

}
void Person::sayHello()
{
    std::cout << "hello world";
}


int main(void)
{
    Humankind humanKind = Humankind();
    humanKind.sayHello();

    Person person = static_cast<Person>(humanKind);

    humanKind.sayHello();
    person.sayHello();
    std::cin.get();
}

 

posted @ 2016-05-12 01:40  注销111  阅读(381)  评论(0编辑  收藏  举报