CoolInterview.com - World's Largest Collection of Interview Questions
Send Free SMS
 Interview Questions  
 Our Services  


INTERVIEW QUESTIONS LANGUAGES C++ DETAILS
Question :
What are advantages of pure virtual function?

Posted by: satish on 1/5/2008

Contact satish  Contact satish
Category C++ Interview Questions
Rating (5.0) By 19 users
Added on 1/5/2008
Views 1018
Rate it!
Answers:

when virtual member function of base class has no important task then it is advisable to overload this virtual member function by any derived class member function .



 Posted by: ketan    

Contact ketan  Contact ketan

Helps to design the code with better approach e.g., Abstract Class.



 Posted by: Sivakumar Selvam    

Contact Sivakumar Selvam  Contact Sivakumar Selvam

If we have to derive multiple classes from base class and these classes need methods of same type, then in this case take the base class as abstract and derive all the classes from it and implement the methods as desired in derived class.



 Posted by: Amit Raj    

Contact Amit Raj  Contact Amit Raj

Pure virtual functions in the base class doesn't have any body.
The main advantage is that if a class has a pure virtual function, then its all derived classes must implement that function in them.
One more advantage is that it tells the user that the object of that class cannot be created.



 Posted by: Ravikumar Horatti    

Contact Ravikumar Horatti  Contact Ravikumar Horatti

With the help of pure virtual function the base class pointer object can call the derived class member function....



 Posted by: vivekpokhariyal    

Contact vivekpokhariyal  Contact vivekpokhariyal

when we make a function virtual then it is forcing the derived class that it must have to be override and 2ndly this pure virtual fn dont allow to create any object of that class



 Posted by: Amrita Ghosh    

Contact Amrita Ghosh  Contact Amrita Ghosh


If you have the better answer, then send it to us. We will display your answer after the approval.
Name :*
Email Id :*
Answer :*
Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
Process Verification  Enter the above shown code:*
Inform me about updated answers to this question

   
Related Questions
View Answer
When do we use abstract.h?Give an example with a small program.
View Answer
write a program on far,null,near,void ,wild,this pointers? And find out the advantages and disadvantages among these pointers?
View Answer
Write a program on abstract class.
View Answer
Is it possible to know that how much memory used by a member function or constructor?
View Answer
what are the differences between member function and constructor?
View Answer
why c++ is called as object-oriented language? Here what does object mean?
View Answer
what are the differences between c and c++.what are the advantages the are only in c++ but not in c
View Answer
Write a C++ program that contains a structure named ?Student? having two data members

1) Name

2) CGPA
Declare array of structure ?Student? of size 10 .Populate this array by taking data from file inputFile.txt.File inputFile.txt contains Name and CGPA of the students for current semester. There is a single space between the Name and CGPA.

Display the un-sorted list of students on screen. Compare the CGPAs of all the students and sort Student List with respect to CGPA in ascending or descending order.

Display the sorted list of students, highest CGPA and lowest CGPA on screen and also write the result in File outputFile.txt with tab characters between the Name and CGPA.
Sample InputFile.txt
Ahmer 4.0

Aasim 3.5
Usman 3.4
Maria 2.4
Anila 3.0
Humza 2.6
Junaid 3.0
Talaal 3.8
Haris 3.9
Saira 2.6
Sample OutputFile.txt

Sample outputFile.txt





Name CGPA

===============

Maria 2.4

Humza 2.6

Saira 2.6

Anila 3.0

Junaid 3.0

Usman 3.4

Aasim 3.5

Talaal 3.8

Haris 3.9

Ahmer 4.0

===============

Highest CGPA = 4.0

Lowest CGPA = 2.4

































Sample output of screen:



Unsorted List of Students

Name CGPA

Ahmer 4.0

Aasim 3.5

Usman 3.4

Maria 2.4

Anila 3.0

Humza 2.6

Junaid 3.0

Talaal 3.8

Haris 3.9

Saira 2.6



Sorted List of Students

Name CGPA

===============

Maria 2.4

Humza 2.6

Saira 2.6

Anila 3.0

Junaid 3.0

Usman 3.4

Aasim 3.5

Talaal 3.8

Haris 3.9

Ahmer 4.0

===============

Highest CGPA = 4.0
Lowest CGPA = 2.4
View Answer
how can we made digital calendar by using c++ class
View Answer
What is the difference between composition and inheritance?
View Answer

Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

Notify me when better answer is posted!
Email:

View ALL C++ Interview Questions

User Options
Sponsored Links


Copyright ©2003-2010 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions
Page URL: http://www.coolinterview.com/interview/12663/default.asp?cachecommand=bypass


Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Free SMS | Dedicated Servers | Joke of the Day

0.98