Like your previous questions answer if you have called any class method you need to reference the class. So you need to replace this line
$theme_options = $mafongroup_menu_page_creation_method( $page_title, $menu_title, $capability, $menu_slug, $function,'dashicons-image-filter', '2.111111');
With this one-
$theme_options = $mafongroup_menu_page_creation_method( $page_title, $menu_title, $capability, $menu_slug, array( $this, $function ),'dashicons-image-filter', '2.111111');
So your above code will be like below-
class mafongroup_admin {
public function __construct() {
add_action( 'admin_menu', array( $this, 'mafongroup_admin_menu' ) );
add_action( 'admin_init', array( $this, 'mafongroup_admin_menu_function' ));
}
public function mafongroup_admin_menu(){
if ( current_user_can( 'edit_theme_options' ) ){
$page_title="MAFON GROUP";
$menu_title="MAFON GROUP";
$capability="administrator";
$menu_slug="mafongroup_admin_settings";
$function="mafongroup_admin_menu_function";
$mafongroup_menu_page_creation_method = 'add_menu_page';
$mafongroup_submenu_page_creation_method = 'add_submenu_page';
$theme_options = $mafongroup_menu_page_creation_method( $page_title, $menu_title, $capability, $menu_slug, array( $this, $function ),'dashicons-image-filter', '2.111111');
}
}
public function mafongroup_admin_menu_function(){
echo 'do something';
}
}
new mafongroup_admin();
Hope that helps.