Frage im Vorstellungsgespräch bei Qualcomm

C++ Qs : virtual functions and function overloading

Antworten zu Vorstellungsgespräch

Anonym

27. Okt. 2011

multiplication by 7 = multiplication by (8 - 1) long 7mul_without_star(int n){ return ((n << 3) - n); }

3

Anonym

27. Okt. 2011

virtual function is a function in the parent class that allows to be overridden (allowing for dynamic polymorphism). with virtual function (in C++) there is a special virtual pointer table that is generated by compiler to track functions ). hence sizeof(class) will be usual size + sizeof(ptr) if function is not declared virtual and overridden always the function in parent gets called.