I'm wondering if it is possible to add methods in main program to an existing class defined in header file.
For example:
There is class CFun defined in file CFun.hpp, but in our party.cpp we want to add a method void hello() {cout << "hello" << endl;};without editing CFun.hpp
Obviously (unfortunately) construction:
#include "CFun.hpp"
class CFun
{
public:
void hello() {cout << "hello" << endl;};
};
doesn't work returning an error Multiple declaration for 'CFun'
Is it possible to make it work without class inheritance?