0
Help with question
Fill in the blanks to define a "Father" class with a final method useMoney() that cannot be overridden in its "Son" subclass. Class Father{ final function useMoney() { echo "wisely"; } } class Son ????Father { public function sayHi() { }
10 odpowiedzi
+ 4
I hope you answer:final
class
extends
+ 2
Always remember " final methods cannot be overridden but can be overloaded."
+ 2
class Father {
final
function useMoney() {
echo "wisely";
}
}
class
Son
extends
Father {
public function sayHi() {
echo "Hi!";
}
}
0
class Father {
final
function useMoney() {
echo "wisely";
}
}
class
Son
extends
Father {
public function sayHi() {
echo "Hi!";
}
}
0
class Father {
final
function useMoney() {
echo "wisely";
}
}
class
Son
extends
Father {
public function sayHi() {
echo "Hi!";
}
}
0
class Father {
final
function useMoney() {
echo "wisely";
}
}
class
Son
extends
Father {
public function sayHi() {
echo "Hi!";
}
}
0
Here is the solution:
class Father {
final
function useMoney() {
echo "wisely";
}
}
class
Son
extends
Father {
public function sayHi() {
echo "Hi!";
}
}
0
0
final , class and extends