Question: I encountered an issue while trying to do something in the process of learning C++ and I am not sure how to handle the situation:

```
class Command
{
  public:
    const char *       Name;
    uint32             Permission;
    bool (*Handler)(EmpH*, const char* args); // I do not want to change this by adding more arguments
};
class MyClass : public CommandScript
{
 public:
  MyClass() : CommandScript("listscript") { }
  bool isActive = false;
  Command* GetCommands() const
  {
      static Command commandtable[] =
      {
          { "showlist", 3, &DoShowlistCommand } // Maybe handle that differently to fix the problem I've mentioned below?
      };
      return commandtable;
  }
  static bool DoShowlistCommand(EmpH * handler, const char * args)
  {
     // I need to use isActive here for IF statements but I cannot because
     // DoShowlistCommand is static and isActive is not static. 
     // I cannot pass it as a parameter either because I do not want to
     // change the structure of class Command at all

     // Is there a way to do it?
  }
};

```

Any help would be greatly appreciated! :)

Answer: 
There are two potential answers here:

1. about use of non static items in a static functions:
-------------------------------------------------------

As said in [our previous question/answer](https://stackoverflow.com/questions/35370901/call-non-static-variable-from-a-static-function/35371229?noredirect=1#comment58530435_35371229), this is not possible, unless you'd have in the static function a specific `MyClass` object (and use `object.isActive`). Unfortunately, you can't do this here :

* your code comments clearly show that you can't add a `MyClass` parameter to the function call;
* the existing parameters don't suggest that you have already a pointer to parent class object;
* it would not be adivsable to use global objects in such a context.

2. about what your're trying to do:
-----------------------------------

It seems that you want to have the function static, because you want to provide it in a table that maps script-commands to function pointers.

**Alternative A**

If all the function pointers used in `commandtable` are members of `MyClass`, you could think of using a pointer to a member function instead of a pointer to a function. The outside object/function that sets isActive on an object, could then refer the pointer to the member function, on the MyClass object it knows.

**Alternative B**

Revise the design of your code to implement your script engine by using the [command design pattern](http://www.oodesign.com/command-pattern.html): it's ideally suited for this kind of problems. It will require some refactoring of your code, but it will be so much more maintenable and extensible afterwards !
> 
> 
> ```
> // Is there a way to do it?
> 
> ```
> 
> 

No.

Either pass it as parameter, make it static, or make `DoShowlistCommand` non-static.