Post reply

The message has the following error or errors that must be corrected before continuing:
Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.

Message icon:
Please leave this box empty:

Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

shortcuts: alt+s submit/post or alt+p preview

Topic Summary

Posted by jamemu
 - Sep 18, 2017, 03:15 PM
Very helpful to me too. I'm learning about this language, it is hard for beginners like me. Thank you for this material.
Posted by Garima Bajpai
 - Nov 22, 2012, 01:13 PM
 - Oct 20, 2012, 08:48 PM
it is very useful for my exam and also know the view of pure virtual function
Posted by Kalyan
 - Jun 28, 2008, 11:49 PM
Pure Virtual Function - C++

A virtual function body is known as Pure Virtual Function. In above example we can see that the function is base class never gets invoked. In such type of situations we can use pure virtual functions

Example : same example can re-written
class base
virtual void show()=0; //pure virtual function

class derived1 : public base
void show()
cout<<"\n Derived 1";

class derived2 : public base
void show()
cout<<"\n Derived 2";

void main()
base *b; derived1 d1; derived2 d2;
b = &d1;
b = &d2;

Rules for Virtual Functions

1. The virtual function must be member of class
2. They cannot be static members
3. They are accessed by using object pointers
4. Prototype of base class function & derived class must be same
5. Virtual function in base class must be defined even though it is not used
6. A virtual function can be friend function of another class
7. We could not have virtual constructor
8. If a virtual function is derived in base class, it need not be necessarily redefined in the derived class
9. Pointer object of base class can point to any object of derived class but reverse is not true
10. When a base pointer points to derived class, incrementing & decrementing it will not make it point to the next object of derived class
IT Acumens | GinGly :: SMS Backup | Acumen :: Discussion Board | AshokPillar :: Hosting | CineBuzz :: Latest Cinema News | My Kids Diary :: Capture your kids magical moment
Copyright 2005 - 2017 :: IT Acumens :: All Rights Reserved.
ITAcumens Forum with 2 lakhs post running for 10 years - Powered by HostGator Dedicated Server