perhaps it’s just that the “data” is a public property of $ post containing the wth object, for example, the text property:
class Textable { public $text; function __construct($intext) { $this->text = $intext; } } class Post { public $data; function __construct() { $data = new Textable("jabberwocky"); } }
this will allow you to do:
$post = new Post(); echo( $post->data->text );
Of course, the correct way to OOP is to make the property private and allow access using the getter function, but beyond the point ...
source share