scan0002 - MOCK EXAM 4(Eveniclass Base*code;andclass...

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: MOCK EXAM 4. (Eveniclass Base {/*code*/};andclass Derived : public Base {/*code*/}; Consider each question separately and answer YES or NO. a) If Base has virtual functions then Derived must override them all N G‘- b) Any virtual function in Derived must be virtual in Base N D c) ~Base should be Virtual 1 5‘19 ‘4 a? (1) Any object of type Derived is a object of type Base {U c) Any object of type Base is a object of type Derived 5i t f) Assigning an object of type Base to Derived is called slicing NS f5 g) By default pure virtual functions in Base are PV in Derived V ,1 h) By default, the default Derived constructor calls Base default constructor before executing any other code 2i 11> i) ~Derived always calls ~Base after its body is executed “is j) Assignment in Derived should call Base: :operator = (*this) ; :‘i O k) IfBase has friend operator<< then it is also a friend OfDerived {‘3 -1 5. Given: class myClass { public: void foo() { /* Some code */ } private: /*Some other code*/ }; What does the declaration of this look like inside function foo? \ . NW, {595 ‘6“ :0 N V. 5“” .I l 6. Given: void myFunc(int* p) { try{ if (p 1: NULL) throw 2; else throw "This is tricky"; } catch(int) { cout << ”Caught an int!" << endl; Final Exam Review — Page 2 ...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern