I have a question about inheritance in C++. Suppose there is a base class called "A", with a protected variable "list_" which basically stores a list of objects with type "P", and also there is a method in class A which adds objects to the list.
There are two classes called "A1" and "A2" respectively, which are derived from the base class "A". assume a1 and a2 are instance of A1 and A2, and a1, a2 add "P" objects based on different conditions, so a1 and a2 have their own list of "P" objects with name "list_", is this correct?
And if the above is true, then is it possible to change one field of a specific "P" object from the "list_" in "a1" with some function in class "A2"?
Thanks a lot for any comment.