adding cs142 code
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#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);
|
||||
};
|
||||
Reference in New Issue
Block a user