Abstract class echo not working


I am starting to work with

abstract class

I have the following code:


abstract class Form


abstract public function inputs();

abstract public function validate();


class A extends Form{

function inputs(){

return ’ this inputs <br>’;



class B extends Form{

function validate(){

return ‘this is validate’;



$a = New A;

echo $a->inputs();

$b = new B;

echo $b->validate();

However it does not give me the results for the following methods

Inputs() and validate();

What am I doing wrong?

Please advise.


there’s a major error in your code, always have a look at the error.log of your server first - or post it on e.g. www.3v4l.org - and set your code into code-tags when you post it or people have to make extra affort converting quotes to test your code

Fatal error: Class A contains 1 abstract method and must therefore be declared abstract or implement the remaining methods


Thank you for your reply.

It is still unclear were do I add this information in my code.

Can you please tell me where I add what you wrote in the code?


Hi @swimmer
The abstract class Form has 2 functions. When you extend it in class A and class B you must implement all of the 2 methods not only one.

1 Like

Thank you for your help.