Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

shared class members

Status
Not open for further replies.

bedrock

Programmer
Nov 6, 2002
94
US
i have a c# library with 2 objects, say object1 and object2. object1 is created each time an instance of internet explorer is opened (through a bho written in vc++). object1 then creates an instance of object2, which stores data and does some logging type operations. this works fine, except object2 has some members that i need to be shared between all instances of object1. i thought that simply making them static would be ok, but this doesnt seem to be the case.

normally i would create one instance of object2, and pass that in to each instance of object1, and there would be no problem. but an instance of the bho object is created for every ie window that is opened, so there is no opportunity to do that in this case. is there some property i can add to the class or to the members to fix this, or can someone think of another way to get around my problem?

fyi: i know my app sounds like spyware, because it is spyware. but it is for a good reason, i am helping with research at my university to make personalized search results. so dont judge me :)

what we see depends mainly on what we look for.
--John Lubbock
 
i would write an interface. a class that all instances of object 1 and of object 2 can use to pool information.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top