Check out example codes for "one space diagonally in java". It will help you in understanding the concepts better.

Code Example 1

class Point {
    private:
        int x, y;
    public:
        Point(int i, int j); // x = i; y = j;
        int GetX();
        int GetY();
        void SetX(int i);
        void SetY(int j);
        void SetPoint(int i, int j); x = i; y = j;
}

Learn ReactJs, React Native from akashmittal.com