-
Notifications
You must be signed in to change notification settings - Fork 0
/
User.h
65 lines (50 loc) · 1.5 KB
/
User.h
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//
// Created by Hemanth Karnati on 11/28/23.
//
#include "iostream"
#include "stack"
#include "vehicle.hpp"
#ifndef CMPE126LAB_USER_H
#define CMPE126LAB_USER_H
class User
{
private:
std::string name, email, address, phone_number;
protected:
std::stack<Vehicle> list_of_cars;
public:
friend std::ostream & operator << (std::ostream &out, const User buyer);
friend std::istream & operator >> (std::istream &in, User &b);
std::string getName() const {return name;}
std::string getAddress(){return address;}
std::string getEmail(){return email;}
std::string getNumber(){return phone_number;}
virtual void displayInfo() const
{
std::cout << "Name: " << name <<
"\nHome Address: " << address <<
"\nEmail Address: " << email <<
"\nPhone #: " << phone_number << std::endl;
}
};
std::ostream & operator << (std::ostream &out, const User buyer)
{
out << "Name: " << buyer.name <<
"\nHome Address: " << buyer.address <<
"\nEmail Address: " << buyer.email <<
"\nPhone #: " << buyer.phone_number;
return out;
}
std::istream & operator >> (std::istream &in, User &b)
{
std::cout << "Enter your name: \n";
getline(in,b.name);
std::cout << "Enter your email: \n";
getline(in,b.email);
std::cout << "Enter your home address: \n";
getline(in,b.address);
std::cout << "Enter your phone number (just sequence of numbers): \n";
getline(in,b.phone_number);
return in;
}
#endif //CMPE126LAB_USER_H