main.cpp 575 Bytes
Newer Older
刘睿博's avatar
ver 1.0  
刘睿博 committed
1 2 3 4 5
#include <stdio.h>
#include "Human.hpp"
#include "Student.hpp"
#include <vector>

刘睿博's avatar
ver 1.1  
刘睿博 committed
6 7 8 9 10 11 12
class check{
    public:
    explicit check(Student* student){
        printf("Student object created\n");
    }
};

刘睿博's avatar
ver 1.0  
刘睿博 committed
13 14 15 16 17 18 19 20 21 22
int main(int, char**){
    printf("Hello, from stl_debug!\n");
    std::vector<Human*> vec;
    Human human(25, "John Doe");
    Student student(20, "Jane Doe", "MIT");
    vec.push_back(&human);
    vec.push_back(&student);
    for (const auto& h : vec) {
        h->print();
    }
刘睿博's avatar
ver 1.1  
刘睿博 committed
23 24
    auto student1 = static_cast<Student*>(vec.back());
    check check1 = check(student1);
刘睿博's avatar
ver 1.0  
刘睿博 committed
25
}