Join Date: November 2008
Location: India ( chennai )
Posts: 1
hi need help in class
class damu() { function one() { return $name = "damu"; } } ======================= class dharan extends damu() {
function myname () {
$myname = $this->one(); }
function myname2() {
} } ithula function name2
gurusharan
Posted on Nov 30, 2008
Join Date: November 2008
Location: India ( Chennai )
Posts: 2
RE : hi need help in class
You need to specify the class visibility mode or access specifier (private/protected/public). The default (one which is used when nothing is provided as in your case) specifier used is "private". Hence the function can't be used outside the class, even in inherited. You should use either protected (inherited class) or public (to access from anywhere).
benaya
Posted on Nov 18, 2008
Join Date: June 2007
Location: India ( Chennai )
Posts: 90
RE : hi need help in class
Hi, you can do like this.
class damu { public function one() { return $name = "damu"; } } //======================= class dharan extends damu { function myname () { return $myname = $this->one(); }
function myname2() {
} }
$objdharan = new dharan; echo $objdharan->myname();