About :associative array :class index type

In reply to SANJAIKUMAR:

  1. In your associative array declaration, you have specified a class variable obj, not the required class type AB, as the index type. See this for the difference.
  2. Your array declaration needs to come after declaring the class type.
  3. Access the class member a using class_name[obj].a