summaryrefslogtreecommitdiffstats
path: root/C++/Inheritance/Inheritance.cpp
blob: 3d022b4a74d211580327236c321cf9f291c4bbbd (plain) (blame)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// Name: msglm
// Date: Oct-31st-2022
// Program Name: Inheritance
// Description: Inheritance practice

#include <iostream>
#include <fstream>
#include <string>
#include "person.h"
using namespace std;


//Classes
//I love it when my "cat" object can do my taxes because some incompetent intern in upstream decided to
//that the great-great-great-great-great-great-grandparent "basic" object needs that functionality
//
//I also love it when i'm programming and everything must be an object, thus making me have to inherit from 40 million parents who supply their own
//lovely genetic debt and confusion, just to do something simple (Godot and Java both do this and it makes me rage).
//
//OOP is one of those things that's entire purpose, code reuse, is annhiliated by itself once you try to use it and can be replaced by tech we had before. Any time I have the dismay of using an OOPy system, I have to reimplement half the things offered with my own implementations because the junk that's offered is burried under so much inherited cruft that it's outright impossible to use them without breaking a couple keyboards.
//Code reuse is also misnomer, people really mean "functionality reuse", which can be achieved with a mix of good data structure design and subroutines, tech that has existed  since the days of the ENIAC (and theoretically from the days of Turing).
//
//Inheritance alone makes using GOTO calls feel like some revolutionary technology that made the lives of all developers easier.
class student: public person {
    public:
        float GPA;
        string major;
        int hours;
        int yearOfGrad;
};


//Takes in the initalized file and puts it into an object instance
student getStudent() {
    student student;
    string temp;

    cout << "===Enter your information===\n";
    cout << "Please enter your first name: ";
    cin >> temp;
    student.fname = temp;
    cout << "Please enter your last name: ";
    cin >> temp;
    student.lname = temp;
    cout << "Please enter your address: ";
    cin >> temp;
    student.address = temp;
    cout << "Please enter your city: ";
    cin >> temp;
    student.city = temp;
    cout << "Please enter your state: ";
    cin >> temp;
    student.state = temp;
    cout << "Please enter your major: ";
    cin >> temp;
    student.major = temp;
    cout << "Please enter your zip code: ";
    cin >> temp;
    student.zip = stoi(temp);
    cout << "Please enter your phone number: ";
    cin >> temp;
    student.phonenum = stoi(temp);
    cout << "Please enter your GPA: ";
    cin >> temp;
    student.GPA = stoi(temp);
    cout << "Please enter your hours: ";
    cin >> temp;
    student.hours = stoi(temp);
    cout << "Please enter your year of graduation: ";
    cin >> temp;
    student.yearOfGrad = stoi(temp);
    return student;
}

void out(student student) {
	cout << "fname: " << student.fname << endl;
	cout << "lname: " << student.lname << endl;
	cout << "address: " << student.address << endl;
	cout << "city: " << student.city << endl;
	cout << "state: " << student.state << endl;
	cout << "zip: " << student.zip << endl;
	cout << "phonenum: " << student.phonenum << endl;
	cout << "GPA: " << student.GPA << endl;
	cout << "major: " << student.major << endl;
	cout << "hours: " << student.hours << endl;
	cout << "yearOfGrad: " << student.yearOfGrad << endl;

}


int main() {

    out(getStudent());
}

/*
   This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License Version 3 ONLY as published by the Free Software Foundation.

   This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.

   You should have received a copy of the GNU Affero General Public License along with this program.  If not, see <https://www.gnu.org/licenses/>.
   */