Human.cpp 311 Bytes
Newer Older
刘睿博's avatar
ver 1.0  
刘睿博 committed
1
#include "Human.hpp"
刘睿博's avatar
1  
刘睿博 committed
2 3
#include <string>
#include <sstream>
刘睿博's avatar
ver 1.0  
刘睿博 committed
4 5 6 7 8

Human::~Human() {
    printf("Human destructor called\n");
}

刘睿博's avatar
1  
刘睿博 committed
9 10 11 12 13
std::string Human::print() const {
    std::string res;
    std::stringstream ss;
    ss << "My name is " << name_ << " and I am " << age_ << " years old\n";
    ss >> res;
刘睿博's avatar
刘睿博 committed
14
    return res;
刘睿博's avatar
ver 1.0  
刘睿博 committed
15
}