Commit 570daf2d authored by Felix Huther's avatar Felix Huther
Browse files

hoersaalUebung 29.04.2022

parent 58867fa7
......@@ -8,8 +8,13 @@ lectureMember::lectureMember(std::string name,bool isListening)
void lectureMember::PrintName()
{
std::cout << "Hallo";
if(typeid (this) == typeid (Student)){
Student::PrintName();
}
else if(typeid (this)== typeid (Lecturer)){
Lecturer::PrintName();
}
else std::cout << "My name is " << name <<
" and i'm a simple member\n";
}
......@@ -13,14 +13,12 @@ int main()
hdaMember* student1 = new Student("Felix",true);
hdaMember* student2 = new Student("Sven",true);
hdaMember* student3 = new Student("Atta",false);
std::vector<hdaMember*> hoersaal = { dozent,student1,student2,student3};
hdaMember* member = new lectureMember("SimpleGuy",true);
std::vector<hdaMember*> hoersaal = { dozent,student1,student2,student3,member};
for(auto members: hoersaal){
members->PrintName();
}
lectureMember lm("Herr Mayer",true);
lm.PrintName();
return 0;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment