I have a function like so:
void myFunction(MyObject& obj)
{
//lots of code to operate on obj
}
My issue is that sometimes obj will be a pointer to an instance of the type MyObject
void myFunction(MyObject* obj)
{
//...
}
My question is how can I achieve having both function definitions, while not having to repeat any code?