B
Bob Hairgrove
Consider the following:
#include <string>
class A
{
public:
A( const std::string & full_name
, const std::string & display_name)
: m_full_name(full_name)
, m_display_name(display_name) {}
virtual ~A() {}
bool operator==(const A& other) const {
return (m_full_name == other.m_full_name)
&& (m_display_name == other.m_display_name);
}
private:
std::string m_full_name;
std::string m_display_name;
};
class B : public A
{
/* constructors etc. skipped ...*/
public:
bool operator==(const B& other) const {
return A:perator==(other);
}
private: /* etc. */
};
Is there an alternative syntax which can be used when calling the base
class operator== from the derived class (IOW leaving out the keyword
"operator")?
Thanks.
#include <string>
class A
{
public:
A( const std::string & full_name
, const std::string & display_name)
: m_full_name(full_name)
, m_display_name(display_name) {}
virtual ~A() {}
bool operator==(const A& other) const {
return (m_full_name == other.m_full_name)
&& (m_display_name == other.m_display_name);
}
private:
std::string m_full_name;
std::string m_display_name;
};
class B : public A
{
/* constructors etc. skipped ...*/
public:
bool operator==(const B& other) const {
return A:perator==(other);
}
private: /* etc. */
};
Is there an alternative syntax which can be used when calling the base
class operator== from the derived class (IOW leaving out the keyword
"operator")?
Thanks.