forked from wadehuber/codeexamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstaffmember.cpp
More file actions
37 lines (30 loc) · 854 Bytes
/
Copy pathstaffmember.cpp
File metadata and controls
37 lines (30 loc) · 854 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include<iostream>
using namespace std;
class StaffMember {
private:
string name;
string address;
string phone;
public:
// Constructor
StaffMember(const string n, const string a, const string p)
: name(n), address(a), phone(p)
{ }
void print();
};
void StaffMember::print() {
cout << " Name: " << name << endl;
cout << " Address: " << address << endl;
cout << " Phone: " << phone << endl;
}
int main() {
StaffMember emp1("Alice Jenkins", "456 4th", "480-555-4321");
StaffMember * emp2;
emp2 = new StaffMember("Bob Smith", "123 Bank", "480-555-1234");
cout << "Employee 1: " << endl;
emp1.print();
cout << endl << "Employee 2: " << endl;
emp2->print();
cout << endl << "Done!" << endl;
return 0;
}