- Jun 15, 2001
- 35,386
- 2,503
- 126
I'm working on a little something in C# and I've run into a problem. This is where having a piecemeal knowledge of the language is an issue, because I don't even know how to ask the question.
I have an object which I cannot modify called UnModifiedObject. I don't have the code to it. It has 24 foo properties, foo1 through foo24. I would like to add a String property to this and call the new thing ModifiedObject. I thought that this would work:
But I get a massive number of errors saying "'ModifiedObject' does not implement interface member 'UnModifiedObject.foo1'". I'm taking this to mean that it wants me to create code for each of the dozens of foos. I want ModifiedObject to have everything that UnModifiedObject has plus FavoriteColor. Is this possible? I can't imagine that I would need to tell C# to make foo1=foo1, foo2=foo2, etc. Is there a name for what I'm trying to do? How can I do it?
Thanks
I have an object which I cannot modify called UnModifiedObject. I don't have the code to it. It has 24 foo properties, foo1 through foo24. I would like to add a String property to this and call the new thing ModifiedObject. I thought that this would work:
Code:
public class ModifiedObject : UnModifiedObject
{
public String FavoriteColor;
}
...
ModifiedObject.foo13 = 13;
ModifiedObject.FavoriteColor = "Blue";
But I get a massive number of errors saying "'ModifiedObject' does not implement interface member 'UnModifiedObject.foo1'". I'm taking this to mean that it wants me to create code for each of the dozens of foos. I want ModifiedObject to have everything that UnModifiedObject has plus FavoriteColor. Is this possible? I can't imagine that I would need to tell C# to make foo1=foo1, foo2=foo2, etc. Is there a name for what I'm trying to do? How can I do it?
Thanks
