hi,
i need code for how to create an object in class, give the example.
Thanks.
how to create an object in class
Moderator: General Moderators
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
I'm not exactly sure what you are asking
Perhaps have a read in the manual about very basic oop principles
As for creating an actual object, use the new keyword ie..
As for creating an actual object, use the new keyword ie..
Code: Select all
$object = new ClassNameGoesHere();- christian_phpbeginner
- Forum Contributor
- Posts: 136
- Joined: Sat Jun 03, 2006 2:43 pm
- Location: Java
Re: how to create an object in class
How to create object in class ? What do you mean ? For example:qumar wrote:hi,
i need code for how to create an object in class, give the example.
Thanks.
You can create an object within a class in the constructor class:
Code: Select all
<?php
require_once ('class.Foo.php');
class Bar {
private $_foo;
public function __construct () {
$this->_foo = new Foo();
}
}
?>