29 lines
541 B
C
29 lines
541 B
C
|
#include <string>
|
||
|
#include <iostream>
|
||
|
#include <ostream>
|
||
|
#include <sstream>
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
#pragma once
|
||
|
|
||
|
class person
|
||
|
{
|
||
|
private:
|
||
|
string name;
|
||
|
int age;
|
||
|
public:
|
||
|
person(){};
|
||
|
|
||
|
person(const string name, int age): name(name), age(age){};
|
||
|
string as_string() const;
|
||
|
|
||
|
void populate_data();
|
||
|
|
||
|
// you can define and declare in a header too:
|
||
|
inline int dummy_function() { return 42; };
|
||
|
|
||
|
// this is what allows us to do cout << my_person;
|
||
|
friend ostream & operator<<(ostream & os, const person & e);
|
||
|
};
|