<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2697812522675667266</id><updated>2011-11-27T15:45:19.306-08:00</updated><title type='text'>C++ Interview Questions,C++ Questions,C++ Papers</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://cpp-interviewquestions.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2697812522675667266/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://cpp-interviewquestions.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>vikas</name><uri>http://www.blogger.com/profile/13999250810437213517</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>8</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2697812522675667266.post-9103165335639254220</id><published>2010-07-01T21:23:00.000-07:00</published><updated>2010-07-03T23:33:50.178-07:00</updated><title type='text'>More job interview questions</title><content type='html'>Below are few of the resources from where you can get interview  questions:&lt;br /&gt;&lt;a href="http://jobinterviewquestions.co.in/"&gt;Job Interview Questions&lt;/a&gt; : More than 10000 job interview questions with solution to prepare for your job interview&lt;br /&gt;&lt;br /&gt;&lt;a href="http://interview-questions.in"&gt;Interview Questions&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2697812522675667266-9103165335639254220?l=cpp-interviewquestions.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cpp-interviewquestions.blogspot.com/feeds/9103165335639254220/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cpp-interviewquestions.blogspot.com/2010/07/more-job-interview-questions.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2697812522675667266/posts/default/9103165335639254220'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2697812522675667266/posts/default/9103165335639254220'/><link rel='alternate' type='text/html' href='http://cpp-interviewquestions.blogspot.com/2010/07/more-job-interview-questions.html' title='More job interview questions'/><author><name>vikas</name><uri>http://www.blogger.com/profile/13999250810437213517</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2697812522675667266.post-8834183487111908908</id><published>2010-02-04T18:50:00.000-08:00</published><updated>2010-06-27T20:18:21.710-07:00</updated><title type='text'>What is RTTI in C++ ?</title><content type='html'>&lt;p&gt;Runtime Type Information (RTTI) is the concept of determining the type of any variable during execution (runtime.) The RTTI mechanism contains:&lt;span id="more-550"&gt;&lt;/span&gt;&lt;/p&gt; &lt;ul&gt;&lt;li&gt;The operator dynamic_cast&lt;/li&gt;&lt;li&gt;The operator typeid&lt;/li&gt;&lt;li&gt;The struct type_info&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;RTTI can only be used with polymorphic types. This means that with each class you make, you must have at least one virtual function&lt;br /&gt;The dynamic_cast can only be used with pointers and references to objects. It makes sure that the result of the type conversion is valid and complete object of the requested class.&lt;br /&gt;&lt;br /&gt;&lt;div id="cl"&gt; &lt;pre&gt;&lt;code&gt;&lt;br /&gt;// dynamic_cast&lt;br /&gt;#include &lt;iostream&gt;&lt;br /&gt;#include &lt;exception&gt;&lt;br /&gt;using namespace std;&lt;br /&gt;&lt;br /&gt;class Base_Class { virtual void dummy() {} };&lt;br /&gt;class Derived_Class: public Base_Class { int a; };&lt;br /&gt;&lt;br /&gt;int main () {&lt;br /&gt; try {&lt;br /&gt; Base_Class * ptr_a = new Derived_Class;&lt;br /&gt; Base_Class * ptr_b = new Base_Class;&lt;br /&gt; Derived_Class * ptr_c;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;    ptr_c = dynamic_cast&lt; Derived_Class* &gt;(ptr_a);&lt;br /&gt;    if (ptr_c ==0) cout &lt;&lt; "Null pointer on first type-cast" &lt;&lt; endl;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="font-style:italic;"&gt;  ptr_c = dynamic_cast&lt; Derived_Class* &gt;(ptr_b);&lt;br /&gt;    if (ptr_c ==0) cout &lt;&lt; "Null pointer on second type-cast" &lt;&lt; endl;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  } catch (exception&amp;amp; my_ex) {cout &lt;&lt; "Exception: " &lt;&lt; my_ex.what();}&lt;br /&gt; return 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt; &lt;/div&gt; &lt;p&gt;There are  two dynamic_casts from pointer objects of type Base_Class* (namely ptr_a and ptr_b) to a pointer object of type Derived_Class*.&lt;/p&gt; &lt;p&gt;If everything goes well then the first one should be successful and the second one will fail. The pointers ptr_a and ptr_b are both of the type Base_Class. The pointer ptr_a points to an object of the type Derived_Class. The pointer ptr_b points to an object of the type Base_Class. So when the dynamic type cast is performed then ptr_a is pointing to a full object of class Derived_Class, but the pointer ptr_b points to an object of class Base_Class. This object is an incomplete object of class Derived_Class; thus this cast will fail!&lt;/p&gt;&lt;p&gt;bad_cast exception is being thrown in case of conversion fail.&lt;/p&gt;&lt;p&gt;Typeid return an structure of type_info . You can get the detail and type of the object at run time.&lt;br /&gt;&lt;/p&gt;&lt;pre&gt;&lt;code&gt;int * a;&lt;br /&gt;int b;&lt;br /&gt;a=0; b=0;&lt;br /&gt;if (typeid(a) != typeid(b))&lt;br /&gt;  {&lt;br /&gt; cout &lt;&lt; "a and b are of different types:\n";&lt;br /&gt; cout &lt;&lt; "a is: " &lt;&lt; typeid(a).name() &lt;&lt; '\n';&lt;br /&gt; cout &lt;&lt; "b is: " &lt;&lt; typeid(b).name() &lt;&lt; '\n';&lt;br /&gt;  }&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2697812522675667266-8834183487111908908?l=cpp-interviewquestions.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cpp-interviewquestions.blogspot.com/feeds/8834183487111908908/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cpp-interviewquestions.blogspot.com/2010/02/what-is-rtti-in-c.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2697812522675667266/posts/default/8834183487111908908'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2697812522675667266/posts/default/8834183487111908908'/><link rel='alternate' type='text/html' href='http://cpp-interviewquestions.blogspot.com/2010/02/what-is-rtti-in-c.html' title='What is RTTI in C++ ?'/><author><name>vikas</name><uri>http://www.blogger.com/profile/13999250810437213517</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2697812522675667266.post-8863315911023090278</id><published>2010-02-04T18:46:00.000-08:00</published><updated>2010-02-04T18:50:53.999-08:00</updated><title type='text'>C++ Resources and Interview Questions</title><content type='html'>Below are few links on C++ Resources which can help you on your interview preparation&lt;br /&gt;&lt;a href="http://freeonlinebookstore.org/Cpp.htm"&gt;Free C++  Books&lt;/a&gt;&lt;br /&gt;&lt;a href="http://freeonlinebookstore.org/C.htm"&gt;Free C Books&lt;/a&gt;&lt;br /&gt;&lt;a href="http://freeonlinebookstore.org/interview/ShowQuestion.php?subcatid=3&amp;amp;desc=C++"&gt;C++ Interview Questions&lt;/a&gt;&lt;br /&gt;&lt;a href="http://allquestionbank.com/forum/index.php/board,19.0.html"&gt;C++ Questions&lt;/a&gt;&lt;br /&gt;&lt;a href="http://allquestionbank.com"&gt;Interview Questions&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2697812522675667266-8863315911023090278?l=cpp-interviewquestions.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cpp-interviewquestions.blogspot.com/feeds/8863315911023090278/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cpp-interviewquestions.blogspot.com/2010/02/c-resources-and-interview-questions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2697812522675667266/posts/default/8863315911023090278'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2697812522675667266/posts/default/8863315911023090278'/><link rel='alternate' type='text/html' href='http://cpp-interviewquestions.blogspot.com/2010/02/c-resources-and-interview-questions.html' title='C++ Resources and Interview Questions'/><author><name>vikas</name><uri>http://www.blogger.com/profile/13999250810437213517</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2697812522675667266.post-6187285295392161428</id><published>2010-02-04T11:13:00.000-08:00</published><updated>2010-02-04T11:14:23.174-08:00</updated><title type='text'>What is vprt, v-table and how virtual function works</title><content type='html'>Whenever a program has a virtual function declared, a v - table is constructed for the class. The v-table consists of addresses to the virtual functions for classes that contain one or more virtual functions. The object of the class containing the virtual function contains a virtual pointer that points to the base address of the virtual table in memory. Whenever there is a virtual function call, the v-table is used to resolve to the function address. An object of the class that contains one or more virtual functions contains a virtual pointer called the vptr at the very beginning of the object in the memory. Hence the size of the object in this case increases by the size of the pointer. This vptr contains the base address of the virtual table in memory. Note that virtual tables are class specific, i.e., there is only one virtual table for a class irrespective of the number of virtual functions it contains. This virtual table in turn contains the base addresses of one or more virtual functions of the class. At the time when a virtual function is called on an object, the vptr of that object provides the base address of the virtual table for that class in memory. This table is used to resolve the function call as it contains the addresses of all the virtual functions of that class&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2697812522675667266-6187285295392161428?l=cpp-interviewquestions.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cpp-interviewquestions.blogspot.com/feeds/6187285295392161428/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cpp-interviewquestions.blogspot.com/2010/02/what-is-vprt-v-table-and-how-virtual.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2697812522675667266/posts/default/6187285295392161428'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2697812522675667266/posts/default/6187285295392161428'/><link rel='alternate' type='text/html' href='http://cpp-interviewquestions.blogspot.com/2010/02/what-is-vprt-v-table-and-how-virtual.html' title='What is vprt, v-table and how virtual function works'/><author><name>vikas</name><uri>http://www.blogger.com/profile/13999250810437213517</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2697812522675667266.post-4955511777540594376</id><published>2010-02-04T11:10:00.000-08:00</published><updated>2010-02-04T11:11:32.292-08:00</updated><title type='text'>Virtual Constructors and Virtual Destructors in C++</title><content type='html'>&lt;p&gt;A constructor cannot be virtual because at the time when the constructor is invoked the virtual table would not be available in the memory. Hence we cannot have a virtual constructor. &lt;/p&gt; A virtual destructor is one that is declared as virtual in the base class and is used to ensure that destructors are called in the proper order. It is to be remembered that destructors are called in the reverse order of inheritance. If a base class pointer points to a derived class object and we some time later use the delete operator to delete the object, then the derived class destructor is not called&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2697812522675667266-4955511777540594376?l=cpp-interviewquestions.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cpp-interviewquestions.blogspot.com/feeds/4955511777540594376/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cpp-interviewquestions.blogspot.com/2010/02/virtual-constructors-and-virtual.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2697812522675667266/posts/default/4955511777540594376'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2697812522675667266/posts/default/4955511777540594376'/><link rel='alternate' type='text/html' href='http://cpp-interviewquestions.blogspot.com/2010/02/virtual-constructors-and-virtual.html' title='Virtual Constructors and Virtual Destructors in C++'/><author><name>vikas</name><uri>http://www.blogger.com/profile/13999250810437213517</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2697812522675667266.post-2210764946794763135</id><published>2010-02-04T10:28:00.000-08:00</published><updated>2010-02-04T11:02:33.186-08:00</updated><title type='text'>UpCasting and DownCasting in C++</title><content type='html'>Upcasting - UpCasting  is defined as casting a pointer or reference of a derived class type to a type of a pointer or reference to a base class. In case of virtual function implementation we can cast a derived class pointer or reference to base class&lt;br /&gt;&lt;br /&gt;Downcasting is defined as casting a pointer or reference of a base class type to a type of a pointer or reference to a derived class.&lt;br /&gt;Mostly used to restore the object to its original type.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Downcasting can lead to trouble due to contravariance, e.g.:&lt;br /&gt;&lt;br /&gt;struct Base {&lt;br /&gt;int i_;&lt;br /&gt;virtual int foo (void) { return i_; }&lt;br /&gt;};&lt;br /&gt;struct Derived : public Base {&lt;br /&gt;int j_;&lt;br /&gt;virtual int foo (void) { return j_; }&lt;br /&gt;};&lt;br /&gt;void foo (void) {&lt;br /&gt;Base b;&lt;br /&gt;Derived d;&lt;br /&gt;Base *bp = &amp;d; // "OK", a Derived is a Base&lt;br /&gt;Derived *dp = &amp;b;// Error, a Base is not necessarily a Derived&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Problem: what happens if dp-&gt;j_ is referenced or set?&lt;br /&gt;&lt;br /&gt;Since a &lt;span style="font-weight: bold;"&gt;Derived object always has a Base part&lt;/span&gt; certain operations&lt;br /&gt;are ok:&lt;br /&gt;bp = &amp;d;&lt;br /&gt;bp-&gt;i_ = 10;&lt;br /&gt;bp-&gt;foo (); // calls Derived::foo ();&lt;br /&gt;Since base objects don’t have subclass data some operations aren’t&lt;br /&gt;ok&lt;br /&gt;– e.g., accesses information beyond end of b:&lt;br /&gt;dp = (Derived *) &amp;b;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;dp-&gt;j_ = 20; // big trouble!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;C++ permits contravariance if the programmer explicitly casts, e.g.,&lt;br /&gt;dp = (Derived *) &amp;b; // unchecked cast&lt;br /&gt;&lt;br /&gt;RTTI can be used to check the type of the object&lt;br /&gt;&lt;br /&gt;if (Derived *dp = dynamic_cast&lt;derived&gt;(&amp;amp;b))&lt;br /&gt;/* use dp */;&lt;br /&gt;else&lt;br /&gt;/* error! */&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;For a dynamic cast to succeed, the “actual type” of b would have to&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;either be a Derived object or some subclass of Derived&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;dynamic_cast throw bad_cast exception in case of failure&lt;/span&gt;&lt;br /&gt;if the types do not match the operation fails at run-time&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2697812522675667266-2210764946794763135?l=cpp-interviewquestions.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cpp-interviewquestions.blogspot.com/feeds/2210764946794763135/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cpp-interviewquestions.blogspot.com/2010/02/upcasting-and-downcasting-in-c.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2697812522675667266/posts/default/2210764946794763135'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2697812522675667266/posts/default/2210764946794763135'/><link rel='alternate' type='text/html' href='http://cpp-interviewquestions.blogspot.com/2010/02/upcasting-and-downcasting-in-c.html' title='UpCasting and DownCasting in C++'/><author><name>vikas</name><uri>http://www.blogger.com/profile/13999250810437213517</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2697812522675667266.post-342981954338072408</id><published>2010-02-04T10:25:00.000-08:00</published><updated>2010-02-04T10:28:10.028-08:00</updated><title type='text'>What is the difference between overloading and overriding in C++</title><content type='html'>This is one of the most common question asked in C++ interview.&lt;br /&gt;&lt;br /&gt;Overloading : Function overloading ( No change in input parameter or argument)&lt;br /&gt;Overriding : Virtual Function ( When derived class override the base class implementation)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2697812522675667266-342981954338072408?l=cpp-interviewquestions.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cpp-interviewquestions.blogspot.com/feeds/342981954338072408/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cpp-interviewquestions.blogspot.com/2010/02/what-is-difference-between-overloading.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2697812522675667266/posts/default/342981954338072408'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2697812522675667266/posts/default/342981954338072408'/><link rel='alternate' type='text/html' href='http://cpp-interviewquestions.blogspot.com/2010/02/what-is-difference-between-overloading.html' title='What is the difference between overloading and overriding in C++'/><author><name>vikas</name><uri>http://www.blogger.com/profile/13999250810437213517</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2697812522675667266.post-9136592715719699251</id><published>2010-02-04T09:47:00.000-08:00</published><updated>2010-02-04T10:01:21.634-08:00</updated><title type='text'>C++ polymorphism Questions</title><content type='html'>&lt;b&gt;What is polymorphism?&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;Polymorphism is the ability to provide single interface to multiple implementation it may be for an  or function in different ways. Polymorphism gives different &lt;span class="IL_AD" id="IL_AD2"&gt;meanings&lt;/span&gt; or functions to the operators or functions.  A single function usage or an operator functioning in many ways can be called polymorphism. Polymorphism refers to codes, operations or objects that behave differently in different contexts.&lt;br /&gt;There are two types of polymorphism&lt;br /&gt;1. Compile Time Polymorphism ( Static Polymorphism )&lt;br /&gt;2.  Run Time Polymorphism    (Dynamic Polymorphism )&lt;br /&gt;&lt;br /&gt;1.  Compile  time polymorphism&lt;br /&gt;&lt;p&gt;Compile time polymorphism is a term that refers to C++ template programming. For example, at compile time you determine the actual type of a std::vector by what it contains:&lt;/p&gt;  &lt;pre class="prettyprint"&gt;&lt;code&gt;&lt;span class="pln"&gt;std&lt;/span&gt;&lt;span class="pun"&gt;::&lt;/span&gt;&lt;span class="pln"&gt;vector &lt;/span&gt;&lt;span class="str"&gt;&lt;int&gt;&lt;/span&gt;&lt;span class="pln"&gt; vi&lt;/span&gt;&lt;span class="pun"&gt;;&lt;/span&gt;&lt;span class="pln"&gt;&lt;br /&gt;std&lt;/span&gt;&lt;span class="pun"&gt;::&lt;/span&gt;&lt;span class="pln"&gt;vector &lt;/span&gt;&lt;span class="pun"&gt;&lt;/span&gt;&lt;span class="pln"&gt;std&lt;/span&gt;&lt;span class="pun"&gt;::&lt;/span&gt;&lt;span class="kwd"&gt;string&lt;/span&gt;&lt;span class="pun"&gt;&gt;&lt;/span&gt;&lt;span class="pln"&gt; vs&lt;/span&gt;&lt;span class="pun"&gt;;&lt;br /&gt;&lt;br /&gt;or function Overloading is the example of compile time polymorphism&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div style="text-align: left;"&gt;&lt;code&gt;&lt;span class="pun"&gt;2. &lt;/span&gt;&lt;/code&gt;Run Time Polymorphism    (Dynamic Polymorphism )&lt;br /&gt;Virtual function is the example of Run Time polymorphism . At the run time base class pointer decide whether to call the base class function or the derived class function.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre class="prettyprint"&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2697812522675667266-9136592715719699251?l=cpp-interviewquestions.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://cpp-interviewquestions.blogspot.com/feeds/9136592715719699251/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://cpp-interviewquestions.blogspot.com/2010/02/c-polymorphism-questions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2697812522675667266/posts/default/9136592715719699251'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2697812522675667266/posts/default/9136592715719699251'/><link rel='alternate' type='text/html' href='http://cpp-interviewquestions.blogspot.com/2010/02/c-polymorphism-questions.html' title='C++ polymorphism Questions'/><author><name>vikas</name><uri>http://www.blogger.com/profile/13999250810437213517</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
