AccountController can’t extend BaseAccount and BaseController at the same time. If I make all BaseAccount or BaseController methods empty, I can have an interface, but if I implement that interface in two different places, that is, I make a contract to implement a method in two different places, I will have duplicated code. Do interfaces solve DDD with code duplication?
interface A {
function doStuff() {
}
}
class B implements A {
function doStuff() {
// a code
}
}
class C implements A {
function doStuff() {
// the same code!!!
}
}
Little bit confused with your last sentance, but if you want multiple inheritance then you need to do this:
AccountController extends BaseAccount, and BaseAccount extends BaseController
Using this method will enable you to access all member functions of BaseAccount and BaseController from AccountController using $this.