c++ - Any instance access all instances (of a class) -


this may seem trivial question, or may have misunderstood previous information/the research i've done far.

but possible have object function (in c++) can access instances of own type?

in context of usage. wanted have button class, whereby instantiate multiple buttons call function call reference buttons.

buttoninstance.ismousetargetting(cursorcoordinates); 

is possible? if efficient?

or should have class owns button instances call each instance check if mouse coordinates match up?

i'm under impression looking advice on how design this.

in context of usage. wanted have button class, whereby instantiate multiple buttons call function call reference buttons.

you want in button container. button not button container , in gui context have established hirerarchy.

or should have class owns button instances call each instance check if mouse coordinates match up?

yes. have window/container class this.


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -