User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,571 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,762 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 128 | Replies: 2
Reply
Join Date: Jul 2008
Posts: 2
Reputation: mahaguru is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
mahaguru mahaguru is offline Offline
Newbie Poster

intializing variable at time object creation

  #1  
28 Days Ago
Is there any way to initialize a class public variable at the time of object creation. But the case is that I have a child class and I dont want to over ride the parent constrctor. So is there any way out or any function that will be called at the time of object implicitly.

Thanks In advance
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2005
Location: New York state
Posts: 449
Reputation: ShawnCplus will become famous soon enough ShawnCplus will become famous soon enough 
Rep Power: 5
Solved Threads: 65
Sponsor
ShawnCplus's Avatar
ShawnCplus ShawnCplus is offline Offline
Code Monkey

Re: intializing variable at time object creation

  #2  
28 Days Ago
http://us3.php.net/manual/en/language.oop5.decon.php
Unless you have created a constructor that overrides the parent constructor it will use the inherited method
GCS d- s+:+ a-->? C++(++++) UL+++ P+>+++ L+++ !E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r z+*
Reply With Quote  
Join Date: Sep 2005
Posts: 639
Reputation: digital-ether has a spectacular aura about digital-ether has a spectacular aura about 
Rep Power: 5
Solved Threads: 38
Moderator
digital-ether's Avatar
digital-ether digital-ether is offline Offline
Practically a Master Poster

Re: intializing variable at time object creation

  #3  
27 Days Ago
Originally Posted by mahaguru View Post
Is there any way to initialize a class public variable at the time of object creation. But the case is that I have a child class and I dont want to over ride the parent constrctor. So is there any way out or any function that will be called at the time of object implicitly.

Thanks In advance


I don't think there is anything else called by the PHP engine during instantiation of a class except for the constructor.

I think the question is why you don't want to override the parent. If the child class calls the parents constructor within its own constructor, then its just like not overriding the parent, except that you have are few more function calls.
www.fijiwebdesign.com - web design and development and fun
Cpanel Email - Let users Register email accounts on your website upon registration
Ajax Chat - Fully browser based chat!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb PHP Marketplace
Thread Tools Display Modes

Other Threads in the PHP Forum

All times are GMT -4. The time now is 10:21 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC