What are the two non-virtual functions
bool operator ==(const DerivedFromSomeInterfaceIF& right) const
bool operator !=(const SomeInterfaceIF& rhs) const;
in SomeInterfaceIF class doing, if anything?
There is no cooresponding .cpp file with any implementation for them. I don't get what the purpose of these are since they are not marked as pure virtual and have no implementation. I get no compile errors.
Code:#include <cstdlib> #include <iostream> using namespace std; class SomeInterfaceIF { public: virtual string getName() = 0; virtual string getValue() = 0; bool operator ==(const SomeInterfaceIF& rhs) const; bool operator !=(const SomeInterfaceIF& rhs) const; virtual ~SomeInterfaceIF(){}; }; class DerivedFromSomeInterfaceIF : public SomeInterfaceIF { public: virtual string getName() { // do something here } virtual string getValue() { // do something here } bool operator ==(const DerivedFromSomeInterfaceIF& right) const { // do something here } bool operator !=(const DerivedFromSomeInterfaceIF& right) const { // do something here } private: string thename; string thevalue; }; int main(int argc, char *argv[]) { DerivedFromSomeInterfaceIF intIf; system("PAUSE"); return EXIT_SUCCESS; }
I'm I correct that the two definitions serve no purpose since they are no marked as pure virtual and no implementation in provided?
Thanks.




Reply With Quote