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

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

刘睿博's avatar
ver 1.0  
刘睿博 committed
14 15 16 17 18 19 20 21
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) {
刘睿博's avatar
刘睿博 committed
22
        std::cout << h->print();
刘睿博's avatar
ver 1.0  
刘睿博 committed
23
    }
刘睿博's avatar
ver 1.1  
刘睿博 committed
24
    auto student1 = static_cast<Student*>(vec.back());
刘睿博's avatar
刘睿博 committed
25
    // check check1 = check(student);
刘睿博's avatar
ver 1.1  
刘睿博 committed
26
    check check1 = check(student1);
刘睿博's avatar
刘睿博 committed
27 28
    LOG(DEBUG) << student1->print();
    LOG(WARNING) << human.print();
刘睿博's avatar
ver 1.0  
刘睿博 committed
29
}