+ Reply to Thread
Results 1 to 3 of 3

Thread: What is pure virtual function call?

  1. #1

    What is pure virtual function call?

    Hi all,

    What is pure virtual function call?

    Help.

  2. #2
    'pure virtual function call' is to make a call to virtual function which has no implementation!

    It means virtual method is defined pure but someone has made call to it.

    Example of how it can occur:

    Code:
    class CBase ;
    
    void CallPureVirtualFunction(CBase *pBase) ;
    
    class CBase
    {
    public:
       virtual void PureVirtualFunction() = 0;
       CBase()
       {
    	   CallPureVirtualFunction(this) ;
       }
    } ;
    
    class CDerived : public CBase
    {
    public:
    	CDerived() : CBase()
    	{
    	}
    
       void PureVirtualFunction() { }
    } ;
    
    void CallPureVirtualFunction(CBase *pBase)
    {
    	pBase->PureVirtualFunction() ;
    }
    
    int main()
    {
          CDerived objDerived ;
    }

  3. #3
    Great, I got it.


+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts