I have the following situation, but I feel like I'm doing something wrong...

I used a interface for Field according to this post. The Field interface inherits from the Style class and Field1, 2 and 3 inherit from the Field interface. I want to construct a Label object with a couple of different types of fields which each have their own styling. I'm not sure if I'm doing it the right way like this, especially because I get the following error when I try to compile: Type 'Style' in interface list is not an interface
My code:
public interface Field : Style
{
int Xpos { get; set; }
int Ypos { get; set; }
int Zindex { get; set; }
}
What is the best way to solve this?
EDIT
I know inheriting a class from an interface is impossible, but what would be the best approach here?
Find/Create an interface that is utilized by Style and inherit that interface on the field interface.
Note, field interface should be named IField.
If Style is your own class
public interface IStyle
{
/* Style properties */
}
public class Style : IStyle
{
/* Style implementations */
}
public interface IField : IStyle
{
int Xpos { get; set; }
int Ypos { get; set; }
int Zindex { get; set; }
}
public class Field : Style, IField
{
public int Xpos { get; set; }
public int Ypos { get; set; }
public int Zindex { 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