How to give access to many classes, all derived from a base class

By : Vidak

I've got a class Figure, and its derived classes, King, Queen, Rook, Bishop, Pawn, etc. Also, theres the class Field, which models the characteristics of a chess field.

Now, all of my derived classes, namely King, Queen, Rook, etc. need to access private information held in class Field. How can I make this happen rather than manually writing in class Field: friend class King; friend class Queen;... ?

Is there a way to provide access to all those classes at once to the class Field?

By : Vidak

This video can help you solving your question :)
By: admin