Re: classes problem - am I being stupid?

From: Date: Wed, 13 Sep 2000 15:48:47 +0000
Subject: Re: classes problem - am I being stupid?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-16575@lists.php.net to get a copy of this message
oops! So sorry, I was being stupid after all! I had edited the file on the wrong machine. Again, sorry. - Kev Carroll Barrett wrote: > Kevin, > > I copied/pasted your code into a php script, ran it, and got the > output from *both* functions. Are you sure you posted the code > exactly as it is in your script? > > Regards, > Carroll Barrett > > -----Original Message----- > From: kev <kevin.porter@fastsearch.com> > To: php-general@lists.php.net <php-general@lists.php.net> > Date: Wednesday, September 13, 2000 9:41 AM > Subject: [PHP] classes problem - am I being stupid? > > >Hi, > > > >Please take a look at the following short piece of code: > > > >--- Start --------- > > > ><? > >class c1 > >{ > > function c1() > > { > > } > > function func1() > > { > > echo "This is c1::func1<BR>"; > > } > > function func2() > > { > > echo "This is c1::func2<BR>"; > > } > >} > > > >class c2 extends c1 > >{ > > function c2() > > { > > } > > function func1() > > { > > echo "This is c2::func1<BR>"; > > } > > function func2() > > { > > echo "This is c2::func2<BR>"; > > } > >} > > > >$c1 = new c1(); > >$c1->func1(); > > > >$c2 = new c2(); > >$c2->func1(); > >?> > >--- End ------------ > > > >... and please tell me why it gives this output: > > > >This is c1::func1 > > > >... instead of this output: > > > >This is c1::func1 > > > >This is c2::func1 > > > >Sorry if I've done something dumb, but I've stared at it long > enough and can't see > > > >what's wrong! > > > >thanks, > > > >- Kev > > > >-- > >http://www.fa-premier.com - English Premier League Football > > > > > > > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > >For additional commands, e-mail: php-general-help@lists.php.net > >To contact the list administrators, e-mail: > php-list-admin@lists.php.net > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net -- http://www.fa-premier.com - English Premier League Football

« previous php.general (#16575) next »