This is a small C++ project I made to practice object-oriented programming (OOP) ideas like classes, inheritance, and pointers. The program simulates a simple school system where you can add teachers and students, assign classrooms, enroll students, and see teacher evaluations.
- Teachers: Base
Teacher
class with derivedMathTeacher
andScienceTeacher
classes, showcasing polymorphism via virtualchat()
methods. - Evaluations: Teachers receive evaluations (grade, comment, feedback), stored in a vector and displayed individually or school-wide.
- Students: Students enroll in teachers’ classes, tracked via
Teacher*
pointers, with formatted enrollment display. - School: Manages teachers and students using
std::vector<Teacher*>
andstd::vector<Student*>
, with methods for adding, enrolling, and displaying data.
- Pointers: I used pointers (like
Teacher*
andStudent*
) so I could keep track of teachers and students without copying them. This also helps when you want to use inheritance and avoid problems like object slicing. - Polymorphism: Some methods (like
chat()
) are virtual, so each teacher type can have their own version. This lets the program call the right method for each teacher, even if you only know the base type. - Encapsulation: Most data is private, and you use getters and setters to access it. This keeps things organized and safe.
- Abstraction: Some methods hide the details of how things work, so you can use them without worrying about the code inside.
These ideas helped me learn how to organize code and use OOP in a small project.
I made this project to get better at using pointers, classes, and OOP in C++. It helped me understand how to organize code for a small system and how to use inheritance and virtual methods.
- Make sure you have a C++ compiler (like g++) installed.
- Compile the code:
g++ src/mainReviewAbstraction.cpp src/fns_*.cpp -I include -o school
- Run the program:
./school
Leonhard Euler's classroom will be #1002 for this year's Mathematics class!
Marie Curie's classroom will be #1003 for this year's Science class!
Emmy Noether's classroom will be #1004 for this year's Mathematics class!
Albert Einstein's classroom will be #1005 for this year's Science class!
Leonhard Euler: I've been teaching Mathematics for 15 years.
Marie Curie: My favorite Science topic is Radioactivity.
Emmy Noether: My favorite Mathematics topic is Abstract Algebra.
Albert Einstein: My favorite Science topic is Relativity.
Rodrigo Casio enrolled in Mathematics with Leonhard Euler (Room 1002)
Rocio Garcia enrolled in Science with Marie Curie (Room 1003)
Alex Chen enrolled in Mathematics with Emmy Noether (Room 1004)
Priya Sharma enrolled in Science with Albert Einstein (Room 1005)
--All Evaluations at University of Alberta-- :
Teacher: Leonhard Euler
- 95 | Euler explains calculus clearly! | More examples needed.
Teacher: Marie Curie
- 92 | Curie’s experiments are inspiring! | Lab sessions could be longer.
Teacher: Emmy Noether
- 98 | Noether makes algebra exciting! | Faster grading, please.
Teacher: Albert Einstein
- 100 | Einstein is an amazing professor! | No feedback needed!
Rodrigo Casio
My GitHub Profile