[PHP] Inheritance of class methods

2008-10-23 Thread Alain Roger
Hi, i have the following classes: class A { public function EchoMe($txt) { echo $txt; } } class B extends A { ... } in theory i can write something like that: $b = new B(); $b-EchoMe(test); and i should get echo test on screen. am i correct ? -- Alain

Re: [PHP] Inheritance of class methods

2008-10-23 Thread Yeti
Using extends means that a class IS-A substructure of its parent class(es). EXAMPLE: class plant { }; class tree extends plant { }; class apple_tree extends tree { }; apple_tree inherits all methods and attributes from plant and tree So if there was a methods plant-growth() you can also call it

Re: [PHP] Inheritance of class methods

2008-10-23 Thread Jochem Maas
Alain Roger schreef: Hi, i have the following classes: class A { public function EchoMe($txt) { echo $txt; } } class B extends A { ... } in theory i can write something like that: $b = new B(); $b-EchoMe(test); and i should get echo test on screen. am i

[PHP] inheritance php4

2006-12-12 Thread blackwater dev
Ok, I have a class which inherits from a parent class. My first thought is that the child class inherits all of the functions of the parent but that doesn't seem to be the case, do I really have to put parent::somefunction() to call each one? Why can't I just use $this-parentfunction(); within

RE: [PHP] inheritance php4

2006-12-12 Thread bruce
12, 2006 11:00 AM To: php-general@lists.php.net Subject: [PHP] inheritance php4 Ok, I have a class which inherits from a parent class. My first thought is that the child class inherits all of the functions of the parent but that doesn't seem to be the case, do I really have to put parent

Re: [PHP] inheritance php4

2006-12-12 Thread Brad Bonkoski
PROTECTED] Sent: Tuesday, December 12, 2006 11:00 AM To: php-general@lists.php.net Subject: [PHP] inheritance php4 Ok, I have a class which inherits from a parent class. My first thought is that the child class inherits all of the functions of the parent but that doesn't seem to be the case, do I

[PHP]inheritance

2003-06-30 Thread Yury B .
Hi I'm with PHP for 4 years now but have feeling that my code doesn't have much order. I only started to use functions, it helped me a lot but I believe if I would learn to wirk with classes that would be what I need. The question: I have class A, class B, and class C now class C extends B

[PHP] Inheritance problem

2002-12-01 Thread Bernard Chamberland
Hi, I would like to post the following question related to an inheritance problem with PHP OO programming : With an object of a subclass, I call a method of the parentclass in order to modify an attribute of the parentclass. It does work correctly but later when I call the display method of

Re: [PHP] Inheritance problem

2002-12-01 Thread Tom Rogers
Hi, Sunday, December 1, 2002, 10:05:53 PM, you wrote: BC Hi, BC I would like to post the following question related to an inheritance BC problem with PHP OO programming : BC With an object of a subclass, I call a method of the parentclass in order BC to modify an attribute of the

Re: [PHP] Inheritance problem

2002-12-01 Thread Ernest E Vogelsinger
At 13:05 01.12.2002, Bernard Chamberland said: [snip] Hi, [snip] [...omitting long code post...] Bernard, couple of things: a) Class Ressource uses instance data ($this-) in the constructor. You shouldn't call this

[PHP] Inheritance Question

2002-10-08 Thread Jarrad Kabral
Hi all, Was just wondering which is the better way to call an inherited method from a child class? Example: class foo { function jk() { echo In here!; } } class bar extends foo { function do_something() { //Either this one... $this-jk(); //Or this

RE: [PHP] Inheritance Question

2002-10-08 Thread Martin Towell
be okay... but I'd use $this-jk() anyway, just to keep it all in the object (just in case...) Martin -Original Message- From: Jarrad Kabral [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 09, 2002 11:18 AM To: [EMAIL PROTECTED] Subject: [PHP] Inheritance Question Hi all, Was just

Re: [PHP] Inheritance and a class function: on what class was it called?

2002-10-03 Thread Debbie Dyer
different to what I know and does (is) causing confusion. Debbie - Original Message - From: Debbie Dyer [EMAIL PROTECTED] To: Rasmus Lerdorf [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, October 02, 2002 11:41 PM Subject: Re: [PHP] Inheritance and a class function: on what class

[PHP] Inheritance and a class function: on what class was it called?

2002-10-02 Thread Nick Eby
Assume you've got some class that has one or more classes inherited from it. The parent class has a function that is normally called using the :: operator (a class function). Assume also that the class function is never called from an object function. Is it possible to find if the class

Re: [PHP] Inheritance and a class function: on what class was it called?

2002-10-02 Thread Debbie Dyer
-foo(); Is this what you mean? Debbie - Original Message - From: Nick Eby [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 02, 2002 6:29 PM Subject: [PHP] Inheritance and a class function: on what class was it called? Assume you've got some class that has one or more

Re: [PHP] Inheritance and a class function: on what class was it called?

2002-10-02 Thread Nick Eby
ROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 02, 2002 6:29 PM Subject: [PHP] Inheritance and a class function: on what class was it called? Assume you've got some class that has one or more classes inherited from it. The parent class has a function that is normally call

Re: [PHP] Inheritance and a class function: on what class was it called?

2002-10-02 Thread Debbie Dyer
PM Subject: Re: [PHP] Inheritance and a class function: on what class was it called? not quite... the case I'm interested in is this, given your example: print C::foo(); which would print nothing, unfortunately, since when the function is called using the :: operator

Re: [PHP] Inheritance and a class function: on what class was it called?

2002-10-02 Thread Nick Eby
should've used the term static from the beginning. /nick - Original Message - From: Debbie Dyer [EMAIL PROTECTED] To: Nick Eby [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, October 02, 2002 11:33 AM Subject: Re: [PHP] Inheritance and a class function: on what class was it called? I

Re: [PHP] Inheritance and a class function: on what class was it called?

2002-10-02 Thread Debbie Dyer
- From: Nick Eby [EMAIL PROTECTED] To: Debbie Dyer [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, October 02, 2002 7:53 PM Subject: Re: [PHP] Inheritance and a class function: on what class was it called? when you call a function with -, you must call it on an object ($c-foo

Re: [PHP] Inheritance and a class function: on what class was itcalled?

2002-10-02 Thread Rasmus Lerdorf
The mistake is mine not yours. I know about the :: operator I use it all the time (but within classes parent::function() etc) - but I never realised until now that PHP will let you use any class before instantiation (and nearly all my PHP work uses classes). I have never even attempted to try

Re: [PHP] Inheritance and a class function: on what class was it called?

2002-10-02 Thread Nick Eby
get_class($this); } } Class B extends A {} B::staticFunc(); thanks again /nick - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: Debbie Dyer [EMAIL PROTECTED] Cc: Nick Eby [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, October 02, 2002 3:08 PM Subject: Re: [PHP

Re: [PHP] Inheritance and a class function: on what class was itcalled?

2002-10-02 Thread Rasmus Lerdorf
::staticFunc(); thanks again /nick - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: Debbie Dyer [EMAIL PROTECTED] Cc: Nick Eby [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, October 02, 2002 3:08 PM Subject: Re: [PHP] Inheritance and a class function: on what

Re: [PHP] Inheritance and a class function: on what class was it called?

2002-10-02 Thread Debbie Dyer
PROTECTED] Sent: Wednesday, October 02, 2002 11:28 PM Subject: Re: [PHP] Inheritance and a class function: on what class was it called? Since static method calls are completely disconnected from any class instance asking which class the method call is from is rather meaningless, and no, I don't

Re: [PHP] Inheritance and a class function: on what class was it called?

2002-10-02 Thread Nick Eby
have to know on what class they were called. anyway thanks again /nick - Original Message - From: Rasmus Lerdorf [EMAIL PROTECTED] To: Nick Eby [EMAIL PROTECTED] Cc: Debbie Dyer [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Wednesday, October 02, 2002 3:28 PM Subject: Re: [PHP] Inheritance

[PHP] Inheritance

2002-07-12 Thread Jason White
I have a class Foo{} which has a method Print(). I have another class FooBar{} which extends Foo{} and has its own method Print(). How do I invoke Foo{}'s Print() method from within FooBar{} once its been overridden? Jason White

Re: [PHP] Inheritance

2002-07-12 Thread Alberto Serra
ðÒÉ×ÅÔ! Jason White wrote: I have a class Foo{} which has a method Print(). I have another class FooBar{} which extends Foo{} and has its own method Print(). How do I invoke Foo{}'s Print() method from within FooBar{} once its been overridden? parent::print(); if you have multilayered

Re: [PHP] Inheritance

2002-07-12 Thread Alberto Serra
ðÒÉ×ÅÔ! if you have multilayered inheritance you may explicitely say which anceStor class you are calling, like foo::print(). two typos in a few words are definitely too much, sorry :) BTW, although almost all class specification is dynamic you cannot dynamically specify a class name in