PHP物件導向-測試題(6~10)

來源:互聯網
上載者:User

6. What OOP construct unavailable in PHP 4 does the following script approximate?

class my_class
{
  function my_funct ($my_param)
  {
    user_error ("Please define me", E_ERROR);
  }
  function b()
  {
    return 10;
  }
}

A. Multiple inheritance
B. Interfaces
C. Abstract methods
D. Private methods
E. Function overloading

7. Assume that a class called testclass is defined. What must the name of its constructor method be?
A. __construct
B. initialize
C. testclass
D. __testclass
E. Only PHP 5 supports constructors

8. How can a class override the default serialization mechanism for its objects?
A. By implementing the __shutdown and __startup methods
B. By calling register_shutdown_function()
C. By implementing __sleep() and __wakeup()
D. The default serialization mechanism cannot be overridden
E. By adding the class to the output buffering mechanism using ob_start()

9. In PHP 4, which object-oriented constructs from the following list are not available?
- Abstract classes
- Final classes
- Public, private, protected (PPP) methods
- Interfaces
A. Abstract classes
B. PPP methods
C. Neither PPP methods nor interfaces
D. None of the above are available
E. All of the above are available

10. How would you call the mymethod method of a class within the class itself?
A. $self=>mymethod();
B. $this->mymethod();
C. $current->mymethod();
D. $this::mymethod();
E. None of the above are correct

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.