Home
>
Fresh News > Example of overloading method
Example of overloading method
class COverload
{
public:
COverload(int p) : m_intValue(p)
{ std::cout << "COverload::COverload() " << m_intValue << std::endl; };
virtual ~COverload()
{ std::cout << "COverload::~COverload()" << std::endl; };
public:
void overload(void)
{ std::cout << "COverload::overload() " << ++m_intValue << std::endl; };
void overload(void) const
{ std::cout << "COverload::overload() const " << m_intValue << std::endl; };
protected:
int m_intValue;
};
int main(void)
{
COverload const dd(2);
dd.overload();
COverload bb(3);
bb.overload();
}