Friend class? And Static Const?

I'm learning C++.  Can someone explain to me what the concept of a friend class is?  

Also, when I see code that says static const..what does this do?  Thanks.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

evilrixSenior Software Engineer (Avast)Commented:
A friend class is a class that is allowed to access all the internals of the class it is friends with, this includes all the members that are declared private or protected. You can consider a friend class as an extension to a classes normal interface.

static const does different things depending on the context:

for a class data member it means the value of the member is immutable and only one instance of it exists that all class instances share.

for a class function it means only one instance of it exists that all class instances share.The const will refer to the return value, which be returned as const.

You can also make functions and data members static at file scope but this is deprecated in C++ and should be avoided in preference for unnamed namespace.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
friend class
Shortly: data declared as private are visible from the class friends.

static const:

shaolinfunkAuthor Commented:
Ok, I got the friend class part.

But am a little confused on the static const.  I think my question needs to be parsed further into.

What does "static" mean/do (by itself)?

What does "const" mean/do (by itself)?

And what does "static const" mean/do (combined)?
const means that you are not going to change this variable.
static means that you can use it in the static class methods - the methods that you can call without creating a class instance.
For example
Class CTest:
  static const int x = 1;
    static int howMany() { return x; }

int main()
   int number = CTest::howMany();
   return 0;
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.