If you want to apply the add_action and do_action in combination with class object, you have to use a static function to access your class.
Try this code with your own wording/variables:
class My_Plugin {
protected static $_instance = null;
// Static function used to access this class
public static function get_instance() {
if ( self::$_instance == null ) {
self::$_instance = new self();
}
return self::$_instance;
}
public function __construct() {
add_action('MY_HOOK_NAME', array($this, 'MY_HOOK_FUNCTION'), $args);
}
public function MY_HOOK_FUNCTION($args) {
echo $args;
}
}
Then initialize your class:
My_Plugin::get_instance();
Finally you can use the do_action:
do_action('MY_HOOK_NAME', 'hello my test')