How to create my own widgets in WordPress?

function wp_load_widget () {
register_widget (& # 39; wp_widget & # 39;)
}
add_action (& # 39; widgets_init & # 39; wp_load_widget & # 39;);

The wp_widget class extends WP_Widget {

__construct () function
parent :: __ construct ("wp_widget", __ ("Widget WPBeginner", "wp_widget_domain"), array ("description" => __ (& # 39; WPBeginner Tutorial-based widget example & # 39; wp_widget_domain & # 39;),)
)
}