need help with class in c++ arduino ESP32

Hi, I am trying to make a WPS class for my esp32 controler, because the code it is base on is too long to be in the main.
and I am getting this error:
"sketch\ESP_WPS_config_.cpp: In member function ‘void ESP_WPS_config::wps_setup()’:

ESP_WPS_config_.cpp:70:27: error: invalid use of non-static member function

 WiFi.onEvent(WiFiEvent);

"
someone has answered the question but I didn’t understand it link

thank you in advance.

this is my code:
my main-

#include "ESP_WPS_config_.h"  
ESP_WPS_config workplease;
void setup(void){  workplease.wps_setup();}
void loop() {}

**class hader-**ESP_WPS_config_.h

#ifndef ESP_WPS_config_h
#define ESP_WPS_config_h

#include "WiFi.h"
#include "esp_wps.h"

#define ESP_WPS_MODE      WPS_TYPE_PBC
#define ESP_MANUFACTURER  "ESPRESSIF"
#define ESP_MODEL_NUMBER  "ESP32"
#define ESP_MODEL_NAME    "ESPRESSIF IOT"
#define ESP_DEVICE_NAME   "ESP STATION"


class ESP_WPS_config
{
  public:
   static esp_wps_config_t config;

public:
    void wpsInitConfig();
    String wpspin2string(uint8_t a[]);
    void WiFiEvent(WiFiEvent_t event, system_event_info_t info); 
    void wps_setup();
};
#endif

the functions- ESP_WPS_config_.cpp

#include "ESP_WPS_config_.h"


void ESP_WPS_config::wpsInitConfig(){
  config.crypto_funcs = &g_wifi_default_wps_crypto_funcs;
  config.wps_type = ESP_WPS_MODE;
  strcpy(config.factory_info.manufacturer, ESP_MANUFACTURER);
  strcpy(config.factory_info.model_number, ESP_MODEL_NUMBER);
  strcpy(config.factory_info.model_name, ESP_MODEL_NAME);
  strcpy(config.factory_info.device_name, ESP_DEVICE_NAME);
  }

String ESP_WPS_config::wpspin2string(uint8_t a[]){
  char wps_pin[9];
  for(int i=0;i<8;i++){
    wps_pin[i] = a[i];
  }
  wps_pin[8] = '\0';
  return (String)wps_pin;
}

void ESP_WPS_config::WiFiEvent(WiFiEvent_t event, system_event_info_t info){
  switch(event){
    case SYSTEM_EVENT_STA_START:
      Serial.println("Station Mode Started");
      break;
    case SYSTEM_EVENT_STA_GOT_IP:
      Serial.println("Connected to :" + String(WiFi.SSID()));
      Serial.print("Got IP: ");
      Serial.println(WiFi.localIP());
 //     wifi.host_( wifi.ipToString(WiFi.localIP()) );
      break;
    case SYSTEM_EVENT_STA_DISCONNECTED:
      Serial.println("Disconnected from station, attempting reconnection");
      WiFi.reconnect();
      break;
    case SYSTEM_EVENT_STA_WPS_ER_SUCCESS:
      Serial.println("WPS Successfull, stopping WPS and connecting to: " + String(WiFi.SSID()));
      esp_wifi_wps_disable();
      delay(10);
      WiFi.begin();
      break;
    case SYSTEM_EVENT_STA_WPS_ER_FAILED:
      Serial.println("WPS Failed, retrying");
      esp_wifi_wps_disable();
      esp_wifi_wps_enable(&config);
      esp_wifi_wps_start(0);
      break;
    case SYSTEM_EVENT_STA_WPS_ER_TIMEOUT:
      Serial.println("WPS Timedout, retrying");
      esp_wifi_wps_disable();
      esp_wifi_wps_enable(&config);
      esp_wifi_wps_start(0);
      break;
    case SYSTEM_EVENT_STA_WPS_ER_PIN:
      Serial.println("WPS_PIN = " + wpspin2string(info.sta_er_pin.pin_code));
      break;
    default:
      break;
  }
}

  void ESP_WPS_config::wps_setup(){
    Serial.begin(115200);
    delay(10);
 
    Serial.println();
 

    WiFi.onEvent(WiFiEvent);
    WiFi.mode(WIFI_MODE_STA);
 
    Serial.println("Starting WPS");
 
    wpsInitConfig();
    esp_wifi_wps_enable(&config);
    esp_wifi_wps_start(0);
  }

do you understand the distinction between a class and an object? a class is a type, like int or double. an object is a variable of that type.

It seems to me that WiFi is a class, not an object. you can’t call a (non-static) member function of a class, only of an object.