basic code help.
Posted: Sat Jun 27, 2009 11:07 am
Hi,
I have recently migrated from servlets to php, can you please help me to understand few basic concept of OOPs?
Lets assume that
1. How do I include another class?
a> include "A.php";
2. How do I create an instance of class A in class B?
a> $a -> new B;
3. How do I call function name() of class A?
a> $a->name();
4. How do I assign value to name() of class A?
a> $a -> name("gimpact");
Please correct me if I am wrong. I am learning from the web but some times you know some things are not very clear.
Thank you
I have recently migrated from servlets to php, can you please help me to understand few basic concept of OOPs?
Lets assume that
Code: Select all
<?php
class A
private $name;
{
function name($name){
print $name;
}
}
class B
{
function bar()
{
// Help here!
}
}a> include "A.php";
2. How do I create an instance of class A in class B?
a> $a -> new B;
3. How do I call function name() of class A?
a> $a->name();
4. How do I assign value to name() of class A?
a> $a -> name("gimpact");
Please correct me if I am wrong. I am learning from the web but some times you know some things are not very clear.
Thank you