Does a class have access to protected fields of another, aggregated class during aggregation?
class Date { protected: int year; int month; int day; }; class Application { Date* date; string FinalPoint; int destination; }; class Date { friend class Application; protected: int year; int month; int day; }; So the Application class will get access to all fields of the Data class object. Any object, not only aggregated ...
Not. Direct access to protected fields is possible only through inheritance. (If you do not consider "friends", etc.)
Application "friend" of Date . - AnTSource: https://ru.stackoverflow.com/questions/771698/
All Articles