Monday, April 5, 2010

How to create objects for a class

Answer

To create an object for a class we need to use the keyword "new"

Example

$phpqna = new Phpinterview();

Now the instance is created and assigned to the variable $phpqna

Also we can create any number of instances to a single class

Example

$phpqna1 = new Phpinterview();
$phpqna2 = new Phpinterview();

No comments:

Post a Comment