không yêu cầu SSL trên trang chủ của họ -nói chuyện về một cơ hội tiếp thị bỏ lỡ. Trong chương này, tôi đã cho thấy một số trong những trở ngại an ninh chính phải đối mặt với các ứng dụng web mới và mashup. Đối với các ứng dụng này thành công thì phải có sự tin tưởng của chúng tôi | 46 2-7 EXTENDING CLASSES public function birdCall printf p s says chirp p n this- getName public function display printf p s is a s and costs .2f. p this- getName this- getBreed this- getPrice end class Bird Variations Now let s extend Bird to create a Parrot class. You indicate that Parrot extends Bird by using the extends keyword as follows. What this means is that Parrot inherits all the properties and methods of Bird. For example each instance of Parrot has a birdCall method. Because birdCall is a public method you can redefine it in Parrot without it affecting the birdCall method when called by an instance of Bird or another subclass. This is what we mean by overriding a method of a parent class. class Parrot extends Bird public function birdCall printf p s says squawk p n this- getName You can also override the Bird class constructor. In this case what you do is call the parent s constructor using the parent keyword. This keyword means the class from which the current class is derived and when employing it the double-colon operator is always used to indicate its members. Caution When extending a class in PHP 5 you should always call the parent constructor in the constructor of the derived class this is not done automatically. If you do not call parent _construct at some point in the constructor of the subclass the derived class will not inherit the properties and methods of the parent. Also note that when you do so you must make sure the parent constructor receives any parameters it is expecting. For this reason it is often advantageous to write the parent class constructor in a way such that all parameters have default values however sometimes you do not want this to happen and you must judge this for yourself on a case-by-case basis. 2-7 EXTENDING CLASSES 47 The name is passed to the Parrot constructor you supply the values parrot and 25 for the breed and price parameters. Thus every Parrot has parrot as its breed and 25 as its price and while the price can