You need to use ($post)
to make it accessible within the anonymous function.
public function anotherClass(){
$post = $_POST['test'];
add_action('save_post', function($id) use ($post) {
if(isset($post)) {
$this->sampleFunction($post);
update_meta_box($id, 'key', strip_tags($post));
}
});
}
Also, if you are using php 5.3, you cannot use $this
within the function. You need to use
$that = $this;
add_action(...) use ($post, $that) {
//...
$that->sampleFunction(...)