Pages

Monday, June 18, 2012

C++ Library Problem

Google+

C++ Library Problem

You have a library provided by the vendor. All you have is header files and library files. Library contains the class "Shape" and there is whole hierarchy tree (I mean classes which derive from this base class).

Now you want to add some function "getArea" (not originally present in the class or any of its derived class) in the class "Shape" , you don't have the source code.
Using this library, you have written a lot of code. Now, you have to make some changes so that, any object of "Shape" class (or its derived class) will be able to call this function.

With your strategy, you should be able to override the definition of this function in the derived class.

http://www.careercup.com/question?id=13872673