Hi,
I was wondering if it’s possible to create an object that inherits from 2 or more interfaces that have the same function/method signature.
IVehicleInterface
{
void turnOn();
void Move();
}
ICarInterface
{
void turnOn();
void Move();
Wheels GetWheels();
}
IMachineInterface()
{
TurnOn();
}
ISelfDrivingVehicleInterface()
{
void DriveHome();
void TurnOn();
}
class YOUR_API ATeslaCar : public AActor, public IVehicleInterface,public ICarInterface, public IMachineInterface, public ISelfDrivingVehicleInterface
{
void turnOn();
void Move();
Wheels GetWheels();
void DriveHome();
}
I have followed this post:
https://forums.unrealengine.com/development-discussion/c-gameplay-programming/36455-interfaces-inheriting-from-other-interfaces
And I can extend an interface (but not multiple inheritance, that could solve the problem).
If I try to just inherit all the interfaces it just says that it’s ambiguous and it won’t compile.
I can also solve the problem having one method name per interface, so I’ll end up having 4 “void TurnOn()”, like “TurnOnVehicle”, “TurnOnCar”, “TurnOnMachine”, “TurnOnSelfDriving”.
Can anybody either help me or confirm that this is the case?
Thanks!