The Foo() method cannot be overridden in a child class. Why? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

The Foo() method cannot be overridden in a child class. Why?

The Foo() method cannot be overridden in a child class. Why? class A { final function Foo() { echo "A"; } } class B extends A { function Foo() { echo "B"; } } - None of the options - class A is private - "this" keyword is missing - final methods cannot be overridden Please help me for this.

27th Jun 2020, 5:12 AM
sudan kc
sudan kc - avatar
3 Answers
+ 5
final methods cannot be overridden
19th Dec 2020, 6:25 PM
El Maslohi Hassan
0
u need to make it virtual && the final keyword stops child classes from overriding it
27th Jun 2020, 5:26 AM
assellalou
assellalou - avatar
- 1
final methods cannot be overridden
24th Sep 2020, 3:59 PM
Arnold Caballes Jr.
Arnold Caballes Jr. - avatar