This is probably showing my integrity, but anyway ...
I have a general interface
I pass the interface as a parameter in a method, this method is being responsible for being in a database. Like I have some implementations that are called bugs, incidents, etc., which are called common interface (IE5). These hidden implementations also use inenemerble
Because the bug is different from an event, there are different fields when I pass the interface as a parameter in a method, what if Is there any way to guess the type? So if I pass in the bug object, then I can use my fields, which are not the same fields as the events. These fields are useful for the database. I do not believe because there is no way to know how it will be passed (obviously), but I know that people here have more knowledge. In that situation, what is a better way of talking? Due to similarity, I want to stay on the interface.
EDIT: I think that on the other hand, to generate SQL statement, use some flow control and then it's a parameter
Thanks
The thing about passing objects and interfaces is that you In fact, there should not be any relation with the actual type, as long as it implies the specific base class / interface that you are interested in.
So the constructing argument of that method is to understand that it is a bug, and then reaching those things which exist only for bugs, which are basically not in the OOP manner, However this may be the "best" way in your special case.
I will advise against it, and instead, instead of making it in the form of special cases, try to create a proper OOP method with polymorphism to handle differences.
You mention perseverance, this method is responsible for the collection of Eta somewhere? Perhaps you can separate the part that can collect information to store the information from the storing part, in this way you can ask the object to provide all the appropriate information, from a class Others may be different.
Comments
Post a Comment