I can't seem to understand how to fill an array made in class A with an enumerator type made in class B and these two classes are separate files.
I know some stuff is missing but its just a rough example.
example...
1 2 3 4 5 6 7 8 9 10 11 12
//class A
#using namespace std;
class A
{
private:
int array[5][5];
public:
void setArray(int array[][5];
}
class B
{
public: enum colour_t { Blue, Red, Green, Orange }; // type is public
private: colour_t the_colour = Green ; // member object is private
};
class A // define class A
{
int numbers[4] = { B::Blue, B::Red, B::Green, B::Orange } ;
B::colour_t colours[4] = { B::Blue, B::Red, B::Green, B::Orange } ;
};
Not so good:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
class A ; // declare class A
class B // define class B
{
private: enum colour_t { Blue, Red, Green, Orange };
friend A ; // *** not a great idea if this is 'long-distance' (cross-component) friendship
};
class A // define class A
{
int numbers[4] = { B::Blue, B::Red, B::Green, B::Orange } ;
B::colour_t colours[4] = { B::Blue, B::Red, B::Green, B::Orange } ;
};