I've stumbled upon an issue, and I can not figure out how am I going to solve it.
Let's suppose we have a base class (that may comes from FrameworkA), with a property named subject
:
public class MyClass {
public var subject: String
}
And we have a protocol (that may comes from FrameworkB), with another property but with the same name:
public protocol MyProtocol {
var subject: String { get }
}
Those two properties represent totally different things.
How can I create a class that inherits from MyClass
and implements MyProtocol
?
And how can I use these properties?
public class SecondClass: MyClass, MyProtocol {
var MyProcotol.name: String { // <==== Obviously not allowed
return "something"
}
var MyClass.name: String { // <==== Obviously not allowed
return "something else"
}
}
I think that C# allows some kind of declaration like this, but I'm not 100% sure...