Are you able to define class-implementations in an interface?
For instance (pseudo-code alert!)...
interface IClass1
{
String s { get; set; }
// classes implementing this interface has to implement Class2 as "SubClass"
Class2 SubClass;
}
interface IClass2
{
Int32 i { get; set; }
}
class Class1 : IClass1
{
String IClass1.s { get; set; }
class IClass1.Class2 SubClass
{
Int32 IClass2.i { get; set; }
}
}
The purpose of an interface is to define a contract which is separate from any implementation.
What you can do with an interface is defining a property like so:
interface IClass1
{
String S { get; set; }
Class2 SubClass { get; set; }
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With