Object of class charts could not be converted to string
<p>I have written a class for which the constructor function has 3 arguments. In some function of the class I have to query from db like this
$profit_row->operating_profit.</p>

<p>now instead of writing operating_profit, I want to pass it as a variable to the constructor of the class. So my whole variable becomes
$profit_row->$this->num
where $this->num is initialized in the constructor.</p>

<p>When I do this I get the following error. How to go about this. 
Object of class charts could not be converted to string</p>
