So I recently just learned about the friend and this in C++, I was watching a tutorial for beginners in C++ and programming. I was interested in this syntax or whatever this is and he said that it was a pointer and stores the object's address so I experimented with it.
Btw is it possible to use a different class object from a different class function? If so, how?
Anyways here is the code
||
\/
#include <iostream>
    class A
    {
    public:
        void Aprint()
        {
            std::cout << "It is A " << this->Number << std::endl;
        }
    private:
        int Number = 1;
    };
    class B
    {
    public:
        void Bprint()
        {
            std::cout << "It is B " << std::endl;
        }
    private:
        int Number = 0;
        friend void A::Aprint();
    };
    int main()
    {
       A Abo;
       B Bbo;
       Abo.Aprint();
    }
I want it to print 0 when I use a B class object.
Like show 0 after "It is A" when it is called or when compiled. Cause I want to see what will happen when I use Bbo.Aprint(). I want to know how this and friend works. Still experimenting tho.
Before it was `Bbo.Aprint()` just edited.
 
     
     
    