Calling class methods in constructor

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
TillTheDay
Forum Newbie
Posts: 2
Joined: Sat Sep 25, 2004 10:35 pm

Calling class methods in constructor

Post by TillTheDay »

I'm wondering if it's alrite to call methods from a class within the constructor. So i have a class with various functions, but i want to use some of the functions in the constructor to help get the data formatted and all. Is this ok?
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

It alright is in C++. So it should be alright here too.
TillTheDay
Forum Newbie
Posts: 2
Joined: Sat Sep 25, 2004 10:35 pm

Post by TillTheDay »

Cool, thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

yes, you can call methods inside your constructor.
Post Reply