Question: So I've got two different classes in C++, 

```
#ifndef A_H
#define A_H

class A
{
    public:
        ...
    private:

        static const int MAX = 52;

        int a_array[MAX];

};

#endif // A_H

```

And I'd like to use that array into another class... But I was wondering if I can't just return an array, how should I do it? Am I forced to create another array in the class B and copy it? 

THis would be the second class...

```
#include "A.h"
#ifndef B_H
#define B_H

class B
{
    public:
        ...
        void createNewDeck("here would be the array, or the object I'd like to input to use the array inside");
    private:

        static const int min = 5;

        int a_array[min]

};

#endif // B_H

```

EDIT: I want them to be different, I'd like to have a B method that works with the A class array. I would have a B method that takes some values from that array; something like this so you guys can get my idea.

```
void B::createNewDeck(const A &a){
    a_array[0] = a.a_array[5];
    a_array[3] = a.a_array[48];
}

```

Appreciate your help!

Answer: 
The array is just a pointer to a piece of data. But you need to be very clear on what you want. Do you want to copy the data and have a separate copy to play with? Or do you want the second class to have full access to the original?

You can return the pointer in a function or make the member variable accessible as either public or via a friend.
Easiest way is to make `B` a friend of `A`. That way `B` will have access to `A`'s `private` member.

```
class B; // forward declare B to make it visible in A's scope. Important

class A
{
    private:
        static const int MAX = 52;

        int a_array[MAX];

        friend class B; // !!
        //friend B; // if you have C++11
};

```