Typical case: object-oriented graphic calculator

Source: Internet
Author: User
Classic example: the object-oriented graphic calculator is located in index. echo & nbsp; new & nbsp; Form (index. php); & nbsp; Form is a class with constructor. & Nbsp; echo & nbsp; new & nbsp; Result (); & nbsp classic example: object-oriented graphic calculator
In the index. php file
Echo new Form ("index. php"); // Form is a class with a constructor.

Echo new Result ();
What does this mean? isn't new an object created? In this way, the output object can also be used. What is the name of the created object?
Appendix:
The Form class is constructed as follows:
Function _ construct (){
$ This-> action = $ action;
$ This-> shape = isset ($ _ GET ["action"])? $ _ GET ["action"]: "rect ";
}

------ Solution --------------------
Echo new Form ("index. php"); returns the instantiated object of Form, which is an object. An error is reported when echo is output. print it using print_r.

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.