Yes, something is happening behind the scenes. Since this question has been asked many, many times, please use the "Search" link at the top of the page to find the previous extensive discussions on this topic. Make sure to search through all forums, not just this one.
I think the phrase "behind the scenes" was a little ambiguous i am sorry for it.
what i mean to say is suppose i create a Marker Interface say "GuidGenerator" whose job is to generate the Guid for the implementing class objects.
My understanding is that i have to write some helper classes for this. which will gets executed as soon as some class implement "GuidGenerator" marker Interface.
but i dont know if it is possible if yes how should i structure my code and link all the threads along with it.. thanks,
Joined: Mar 22, 2005
No, that's not an example of marker interfaces. In that case the interface would have one method called "getGUID" or something like that, and all objects implementing the interface would have that method.
But as I said, marker interfaces have been discussed endlessly in these forums. Use the Search feature to find those discussions.
I tried finding but i am sorry to say that i am not able to get the specific answer to my question and one more interesting fact i found that every where people asked about how to create the our own marker Interface and use it but i found every where person who answered did not understand the question properly.
the question is NOT what is marker interface, Question is HOW to create and use our own marker Interface in our project.
May be previous example was not good enough here is one more
Suppose i wanted to have one marker interface say "SaveDateTimeInterface" and its functionality is to save the date and time of the object being saved in to database.
Classes who dont implement this Marker interface, their objects will not be having the date and time values saved in the database.
Hope this example is little more clear than previous.
Originally posted by Tanu Gulati: Suppose i wanted to have one marker interface say "SaveDateTimeInterface" and its functionality is to save the date and time of the object being saved in to database. [/QB]
That is where you are getting things confused. Marker interfaces are NOT supposed to have any methods declared inside them. What you have said is just an example of any other normal interface.