Does this even make PHP? -11

Source: Internet
Author: User
Tags php class

The basic content of the class in PHP exercises:

<?PHPclasssportobject{ Public $name;  Public $height;  Public $avirdupois;  Public function__construct ($name,$height,$avirdupois) {            $this->name =$name; $this->height =$height; $this->avirdupois =$avirdupois; }                functionBeatbasketball () {if($this->height >$this->avoirdupois <= 100) {                return $this->name. ", meet the requirements of playing basketball. "; } Else {                return $this->name. ", not in line with the requirements of playing basketball. "; }        }        functionshowMe () {Echo' This remark will not be shown. ‘; }        function__destruct () {EchoThe <p><b> object is destroyed and the destructor is called. </b></p> "; }    }        classBeatbasketballextendssportobject{ Public $age; function__construct ($name,$height,$age) {            $this->name =$name; $this->height =$height; $this->age =$age; }        functionshowMe () {if($this->age > 18) {                return $this->name. "To meet the requirements of playing basketball."; } Else {                return $this->name. "Not in line with the requirements of playing basketball."; }        }    }        classWeightliftingextendsSportobject {functionshowMe () {if($this->avoirdupois < 85) {                return $this->name. ", in line with weightlifting."; } Else {                return $this->name. "Not in line with weightlifting."; }        }    }        $sport 1=NewSportobject (' Meteor ', ' 185 ', ' 80 '); Echo $sport 1-Beatbasketball (); Echo"<br>"; $sport 2=NewSportobject (' Sky Fly ', ' 185 ', ' 80 '); Echo $sport 2-Beatbasketball (); Echo"<br>"; $Basketball=NewBeatbasketball (' Tomorrow ', ' 190 ', ' 68 '); $weightlifting=NewWeightlifting (' technology ', ' 185 ', ' 80 ', ' 20 ', ' Male '); Echo"<br>"; Echo $Basketball-showMe (); Echo"<br>"; Echo $weightlifting-showMe (); Echo"<br>"; classbookobject{ConstBoot_type = ' Computer book ';  Public $object _name; functionSetobjectname ($name) {            $this->object_name =$name; }        functionGetobjectname () {return $this-object_name; }    }    $c _book=NewBookobject (); $c _book->setobjectname ("PHP class"); #echo Bookobject::book_type. " ";    Echo $c _book-Getobjectname (); classC {function__call ($name,$num) {            Echo"Method Name:".$name." <p></p> "; Echo"The number of parameters exists:".Count($num)." <p></p> "; if(Count($num) = = 1) {                Echo $this->list1 ($a); }            if(Count($num) = = 2) {                Echo $this->list2 ($a,$b); }        }         Public functionList1 ($a) {            return"This is function List1"; }         Public functionList2 ($a,$b) {            return"This is function List2"; }    }    Echo"<br>"; $a=NewC; $a->listshow (1, 2); Echo"<br>"; $b=NewC; $b->listshow (1); ?>

Does this even make PHP? -11

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.