<html>
<head>
<title>Example:2</title>
</head>
<body>
<?php
class first_class
{
var $name="Harry";
function setName($n)
{
$this ->name =$n;
}
function sayHello()
{
print"Hello my name is $this->name<BR>";
}
}
$obj1 = new first_class();
$obj1->setName("SATEESH.BAGADHI");
$obj1 -> sayHello();
?>
</body>
</html>
OUTPUT
Hello my name is SATEESH.BAGADHI
<head>
<title>Example:2</title>
</head>
<body>
<?php
class first_class
{
var $name="Harry";
function setName($n)
{
$this ->name =$n;
}
function sayHello()
{
print"Hello my name is $this->name<BR>";
}
}
$obj1 = new first_class();
$obj1->setName("SATEESH.BAGADHI");
$obj1 -> sayHello();
?>
</body>
</html>
OUTPUT
Hello my name is SATEESH.BAGADHI
No comments:
Post a Comment