-1

MyCode:

#include "YourClass.h"

class MyClass
{
public:
    void doThis()
    {
        YourClass::doThis();
    }
    void doThat()
    {
        YourClass::doThat();
    }
    void doSomething()
    {
        YourClass::doSomething();
    }
};

Is it possible to simplify the static member function calling so I don't have to re-write YourClass:: whenever I call its static members?

Or is it a better practice to leave it like it is?

Zack Lee
  • 2,784
  • 6
  • 35
  • 77

1 Answers1

1

you can use std::bind

auto doThis =  bind(YourClass::doThis);

Thanks to @p.picard You can also do it without bind:

auto doThis =  YourClass::doThis;

compile

Oblivion
  • 7,176
  • 2
  • 14
  • 33