PHP equivalent to super()?

This is a discussion on PHP equivalent to super()? within the PHP Language forums, part of the PHP Programming Forums category; PHP Code: <?phpclass SuperClass {var $mySuperClassVar;function SuperClass($myVar) {$this->mySuperClassVar = $...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-02-2004
Phil Powell
 
Posts: n/a
Default PHP equivalent to super()?

PHP Code:
<?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');

?>
Quote:
hello world
what is up with your bad self
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
Reply With Quote
  #2 (permalink)  
Old 06-02-2004
Tony Marston
 
Posts: n/a
Default Re: PHP equivalent to super()?

Check out this page in the manual:
http://www.php.net/manual/en/keyword.parent.php

--
Tony Marston

http://www.tonymarston.net


"Phil Powell" <soazine@erols.com> wrote in message
news:1cdca2a7.0406020648.19bbbf9e@posting.google.c om...
>
PHP Code:
<?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');
>
?>
>
>
>
Quote:
> hello world
> what is up with your bad self
>
>
> 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



Reply With Quote
  #3 (permalink)  
Old 06-03-2004
Phil Powell
 
Posts: n/a
Default Re: PHP equivalent to super()?

"Tony Marston" <tony@NOSPAM.demon.co.uk> wrote in message news:<c9l61i$l0f$1$830fa17d@news.demon.co.uk>...
> Check out this page in the manual:
> http://www.php.net/manual/en/keyword.parent.php


Ah, that's why I couldn't find it, it wasn't identified as PHP version
of the Java "super" keyword that I could find on the page, thanx

Phil

>
> --
> Tony Marston
>
> http://www.tonymarston.net
>
>
> "Phil Powell" <soazine@erols.com> wrote in message
> news:1cdca2a7.0406020648.19bbbf9e@posting.google.c om...
> >
PHP Code:
> > <?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');
> >
> > 
?>
> >
> >
> >
Quote:
> > hello world
> > what is up with your bad self
> >
> >
> > 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

Reply With Quote
  #4 (permalink)  
Old 06-03-2004
Tony Marston
 
Posts: n/a
Default Re: PHP equivalent to super()?

It is not the function of the PHP manual (or any other language manual for
that matter) to identify the equivalent terminology in Java. That is why
searching the manual using Java keywords is not a good idea.

--
Tony Marston

http://www.tonymarston.net



"Phil Powell" <soazine@erols.com> wrote in message
news:1cdca2a7.0406030737.12520e73@posting.google.c om...
> "Tony Marston" <tony@NOSPAM.demon.co.uk> wrote in message

news:<c9l61i$l0f$1$830fa17d@news.demon.co.uk>...
> > Check out this page in the manual:
> > http://www.php.net/manual/en/keyword.parent.php

>
> Ah, that's why I couldn't find it, it wasn't identified as PHP version
> of the Java "super" keyword that I could find on the page, thanx
>
> Phil
>
> >
> > --
> > Tony Marston
> >
> > http://www.tonymarston.net
> >
> >
> > "Phil Powell" <soazine@erols.com> wrote in message
> > news:1cdca2a7.0406020648.19bbbf9e@posting.google.c om...
> > >
PHP Code:
> > > <?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');
> > >
> > > 
?>
> > >
> > >
> > >
Quote:
> > > hello world
> > > what is up with your bad self
> > >
> > >
> > > 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



Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 08:44 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0