my_func.h
class MyClass{
public:
OtherClass otherclass;
void func();
void func(OtherClass others);
};
my_func.cpp
#includ <my_func.h>
void MyClass::func(){
func(this->otherclass);
}
void MyClass::func(OtherClass others){
if(others.value.IsObject)
func(others.value);
}
main.cpp
#include <my_func.h>
int main(){
func();
}
I want to refactoring this code.
I want to set default parameter, so I write code like this.
but I think there is a better way.
funcare introducing new non-class functions. In order to implement the class methods use e.g.void MyClass::func(){ ... }.default parameterlikevoid func(Otherclass others=this->otherclass)