Polymorphie Data / Function / User

<?php

# Polymorphie Class
# implements all methods
abstract class FunktionClass{

	abstract protected function get_Data( $coming_from = null );

	# universal getter
	public function	get(){
		print_r( 
			$this -> get_Data( __CLASS__ )
		);
	}
}


# implements all data
class DataClass extends FunktionClass{

	# specialized getter
	protected function get_Data( $coming_from = null ){
		return PHP_EOL . "I am from class {$coming_from}!" . PHP_EOL;
	}

}


# implements all buissneslogic
class UserClass{

	public function __construct(){

		# only can see data_methodes
		$my_data = new DataClass();
		$my_data -> get();

		# can't see the methodes from DataClass 
		// $this -> get_Data(); # <- comment out for testing
	}

}

new UserClass();



?>