NYCPHP Meetup

NYPHP.org

[nycphp-talk] Does PHP have an equivalent to super()?

Chris Bielanski Cbielanski at inta.org
Wed Jun 2 10:49:03 EDT 2004


Phil, I think you want "parent::foo();", right?


Thanks,
Chris Bielanski
Web Programmer, 
International Trademark Association,
1133 Avenue of the Americas, 33rd Floor
New York, NY 10036
+1 (212) 642-1745, f: +1 (212) 768-7796
mailto:cbielanski at inta.org, www.inta.org  
INTA -- 125 Years of Excellence



> -----Original Message-----
> From: Phillip Powell [mailto:phillip.powell at adnet-sys.com]
> Sent: Wednesday, June 02, 2004 10:48 AM
> To: NYPHP Talk
> Subject: [nycphp-talk] Does PHP have an equivalent to super()?
> 
> 
> [PHP]
> <?php
> 
>   class SuperClass {
> 
>      var $mySuperClassVar;
> 
>      function SuperClass($myVar) {
>        $this->mySuperClassVar = $myVar;
>        echo "super class var = $myVar<p>";
>      }
> 
>   }
> 
>   class SubClass extends SuperClass {
> 
>     var $mySubClassVar;
> 
>     function SubClass($myVar) {
>      // super('hello world?')???
>      $this->mySubClassVar = $myVar;
>      echo "sub class var = $myVar<p>";
>     }
> 
>   }
> 
>   $obj =& new SubClass('what is up with your bad self');
> 
> ?>
> [/PHP]
> 
> [output]
>   hello world
>   what is up with your bad self
> [/output]
> 
> I am interested in finding out if PHP has an equivalent to the Java 
> "super" keyword that evokes methods or constructor of the 
> class' parent 
> class.  I can't find anything online on this and hoped maybe 
> one of you 
> guys came up with a nice workaround for this in PHP 4.3.2+ 
> that I could 
> learn.  Or point me in the right, open-source, direction for me to 
> figure this out.
> 
> Thanx
> Phil
> 
> -- 
> --------------------------------------------------------------
> -------------------
> Phil Powell
> Multimedia Programmer
> BPX Technologies, Inc.
> #: (703) 709-7218 x107 
> Fax: (703) 709-7219
> 
> 	
> 
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
> 



More information about the talk mailing list