G
Guest
I apologize if this is a stupid question - I'm relatively new to OOP.
I have a property that must exist in a class in order to be used by another class. The property, however, does not change with each instance (it returns an instance of a delegate that points to the same method no matter what the instance).
I thought the best way to make sure that Class1 could be used by Class2 would be to create an interface that defined this property, and that Class1 (and any other classes that Class2 needs to use) could implement.
I tried to implement as a static property, but it won't compile. I can access the property by getting it from an instance, but that doesn't seem like the right way to do things to me (because the property is independent of the instance).
There must be a flaw in my design, but I can't figure it out. Can someone help?
I have a property that must exist in a class in order to be used by another class. The property, however, does not change with each instance (it returns an instance of a delegate that points to the same method no matter what the instance).
I thought the best way to make sure that Class1 could be used by Class2 would be to create an interface that defined this property, and that Class1 (and any other classes that Class2 needs to use) could implement.
I tried to implement as a static property, but it won't compile. I can access the property by getting it from an instance, but that doesn't seem like the right way to do things to me (because the property is independent of the instance).
There must be a flaw in my design, but I can't figure it out. Can someone help?