Why class cannot be a key for a dictionary?

DeepDiverDeepDiver Member Thomas MuellerOrganization: Freelance Software DeveloperProject: Project depend on Customers ✭✭✭
hi zeroc,

just one quick question:

Why class cannot be a key for a dictionary?

as long as the class is used as a value type i think it shall work.

thx tom

Comments

  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    Because classes support inheritance, they could potentially contain anything, including other maps, or floating point types, both of which are not suitable as dictionary keys (at least not for all language mappings).
Sign In or Register to comment.