Not sure why you want a
Role
inside an
Actor
. If you're looking at an
Actor
, the
Actor
field in
Role
would be redundant. Perhaps this would make more sense:
class ActorRole {
Person* part_;
Movie* movie_;
};
class MovieRole {
Person* part_;
Actor* actor_;
};
auto gbu = new Movie("The Good, The Bad, and The Ugly");
auto clint = new Actor("Clint Eastwood");
auto eli = new Actor("Eli Wallach");
auto lee = new Actor("Lee Van Cleef");
AddRole(gbu, clint, "Blondie");
AddRole(gbu, eli, "Tuco");
AddRole(gbu, lee, "Angel Eyes");
where the free function
AddRole
creates an
ActorRole
and adds it to the specified
Actor
and also creates a
MovieRole
and adds it to the specified
Movie
.