rgb192
asked on
instantiate the object to see all the echo statements
<?php
class Person{}
class Vegetable{}
interface ISweat{
function MakeYouSweat();
}
class AttractiveStranger extends Person implements ISweat{
public function LookAtYou(){}
public function SmileAtYou(){}
public function TalkToYou(){}
public function MakeYouSweat(){
$this->LookAtYou();
$this->SmileAtYou();
$this->TalkToYou();
}
}
class Pepper extends Vegetable{
public function BurnYourTongue(){}
public function CauseBathroomEmergency(){}
public function MakeYouSweat(){
$this->BurnYourTongue();
$this->CauseBathroomEmergency();
}
}
class CollegeBar implements ISweat{
public function __construct(){
$attractivestranger=new AttractiveStranger();
$hotpepper=new Pepper();
$thing1=$attractivestranger->MakeYouSweat();
$thing2=$hotpepper->MakeYouSweat();
$thingsThatMakeYouSweat=array($thing1,$thing2);
SitAtBar($thingsThatMakeYouSweat);
}
void SitAtBar(){
//when you are sitting at the Bar
foreach($thingsThatMakeYouSweat as $value){
}
}
}
This is the answer from
https://www.experts-exchange.com/questions/28313720/Parse-error-syntax-error-unexpected-T-STRING-expecting-T-FUNCTION-in-C-wamp-www-oop-beg-ch4-7-php-on-line-38.html
but what are examples of ways I could instantiate the object to see all the echo statements
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Instead of using echo (which will call the __toString() method and will deliberately remove most of the character of the object), use var_dump() to print out the objects before and after you call the methods. By comparing the objects you will be able to see the effect of the programming.
ASKER
Thanks
code moved in my debugger which taught me.
And there was nice easy to read output.
var_dump I opened another question about what Ray wrote.
https://www.experts-exchange.com/questions/28314960/use-var-dump-to-print-out-the-objects-before-and-after-you-call-the-methods.html
code moved in my debugger which taught me.
And there was nice easy to read output.
var_dump I opened another question about what Ray wrote.
https://www.experts-exchange.com/questions/28314960/use-var-dump-to-print-out-the-objects-before-and-after-you-call-the-methods.html