Forum Discussion
Altera_Forum
Honored Contributor
10 years agoThis is because you declared A as class my_a, therefore you only have visibility of variables/functions declared in the my_a class. If you want to see member1 from the my_ea class you will need to cast A to the my_ea class.
This is important because you can have many sub-classes of my_a, with an array of variables all of different classes. The compiler can only see the class of the variable type, it doesnt know what class it is from the handle. This can get a little confusing with virtual/non virtual functions. non-virtual functions will always call the function from the class type of the variable. virtual functions will always call the function from the class declared by the handle, because they get overridden in the base classes.