Consider the following class interfaces: class Teacher {public: Teacher(); Teach
ID: 3580224 • Letter: C
Question
Consider the following class interfaces: class Teacher {public: Teacher(); Teacher(string new_name); string get_name() const; private: String name;}; class MathsTeachcr: public Teacher {public: MathsTeacher(); MathsTeacher(string new_qualification, string new_name); void display_data() const; private: string qualification;}; int main() {Teacher t1, t2("John"); MathsTeacher mt1, mt2("TopLevel", "Sarah"); t_1 = mt1; t1 = t2, mt1 = mc2; mt1 = t1; return 0; Which one of the preceding assignment statements in the function main () would slice away the data of the derived class object? t1 = mt1 mt1 = t1 mt1 = mt2 t1 = t2Explanation / Answer
Answer:
1) which of the preceding assignment statement in the function main() would slice away the data of the derived class object?
ANS: A t1=mt1
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.