Given the following code, how can we use both traits A and Bin the same class? (select all that apply)

Given the following code, how can we use both traits A and Bin the same class? (select all that apply)

trait A {

public function hello() {

return "hello";

}

public function world() {

return "world";

}

}

trait B {

public function hello() {

return "Hello";

}

public function person($name) {

return ":$name";
A . Rename the A::hello () method to a different name using A::hello as helloA;
B . Use B::hello () instead of A’s version using B::hello insteadof A
C . Use B::hello () instead of A’s version using use B::hello
D . Rename the A::hello () method to a different name using A::hello renameto helloA;
E . None of the above (both can be used directly)

Answer: B

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments