C++ constructor bug -


this part of code : declaration in .h file :

virtual bool operator==(const file& file) const = 0; 

and in .cpp file

bool file::operator==(const file& file) const {     return true; } 

i compilation error :

 1>c:\users\talw\desktop\hw5\hw5\project1\main.cpp(76): error c2259:                'directory' : cannot instantiate abstract class  1>          due following members:    1>          'bool file::operator ==(const file &) const' : abstract  1>          c:\users\talw\desktop\hw5\hw5\project1\file.h(57) : see                 declaration of 'file::operator ==' 

please help. thanks

this pure virtual operator overloading making class abstract can have function implementation in same class cannot instantiate abstract class giving below error.

cannot instantiate abstract class

a derived class of abstract file class can have implementation of function , can instantiated.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -