A widget is a PHP object that echoes string data to STDOUT when its
widget() method is called.
— WordPress Widgets API
To create the widget you have to extend the WP_Widget class with your widget class. You use the class name in the register_widget function.
class Foo_Widget extends WP_Widget {
//Class methods here
}
function my_widgets_init() {
register_widget( 'Foo_Widget' );
}
add_action( 'widgets_init', 'my_widgets_init' );