<?
abstract class BaseData
{
protected $connection;
public function __construct($connection)
{
$this->connection = $connection;
}
abstract public function connected();
abstract public function get();
}
class UserData extends BaseData
{
public function exists()
{
return is_connected($this->connection);
}
public function get()
{
return get_data($this->connection);
}
}
$UserData = new UserData(new Connection());
?>
In the above program i`m getting the follwing error: In line 26;
**Fatal error: Class UserData contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (BaseData::connected) in E:\xampp\htdocs\Antony\161214\Abstract\abstract6.php on line 26**
AntonyRayan
15
Posting Whiz in Training
Recommended Answers
Jump to PostThe BaseData class has 2 abstract methods: connected() and get(). The UserData class provides an implementation for the get() function but there is still no implementation for the connected() function. The error message is telling you that either you must declare the UserData class abstract or you must provide an …
All 4 Replies
SalmiSoft
102
Junior Poster
lorenzoDAlipio
24
Junior Poster in Training
Taywin
312
Posting Virtuoso
diafol
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.