25.03.2013 Views

Cracking the Coding Interview - Fooo

Cracking the Coding Interview - Fooo

Cracking the Coding Interview - Fooo

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

13 6 What is name hiding in C++?<br />

SOLUTION<br />

Solutions to Chapter 13 | C++<br />

CareerCup com<br />

pg 76<br />

Let us explain through an example In C++, when you have a class with an overloaded method,<br />

and you <strong>the</strong>n extend and override that method, you must override all of <strong>the</strong> overloaded<br />

methods<br />

For example:<br />

1 class FirstClass {<br />

2 public:<br />

3 virtual void MethodA (int);<br />

4 virtual void MethodA (int, int);<br />

5 };<br />

6 void FirstClass::MethodA (int i) {<br />

7 std::cout

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!