Page 333 - Computer Software Application TP - Volume 1
P. 333
COMPUTER SOFTWARE APPLICATION - CITS
</html>
3 Save the program in C:\Apache24\htdocs in a folder with .php extension
4 Run the Apache services from windows services
5 Open the browser and type the following address
http://localhost/foldername/
6 Click the php file to run and verify the output
TASK 3: Using abstract classes and methods
1 Open the text editor
2 Write the following codes
<html >
<head>
<title> Abstract classes and methods </title>
</head>
<body>
<?php
// Abstract class
abstract class Shape
{
protected $name;
public function __construct($name)
{
$this->name = $name;
}
// Abstract method - no implementation
abstract public function calculateArea();
}
// Concrete subclass of Shape
class Circle extends Shape
{
private $radius;
public function __construct($name, $radius)
318
CITS : IT & ITES - Computer Software Application - Exercise 60