Confuse with Classes

So I'm confuse with a 2 class system program. Can someone help clarify to me how the second class interact with the first class? I'm also adding some comments on how I think the codes interact with each other.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
class Number
{
   public: 
      inline Number() {value = 0;}
      Number(int v){value = v;}
      Number(Number& anotherNumber){ value = anotherNumber.getValue() ;}
      void set(int v) {value = v;}
      int getValue() { return value;}
      
   private:
      int value;   
};
class NumberSystem
{
   public:
      NumberSystem() //initializer
      NumberSystem(Number n1) //get the result of number n1 and assign it to numbersystem n1
      NumberSystem(Number n1, Number n2)//get the result of both number n1 and n2 then assign them to numbersystem n1 and n2
      NumberSystem(NumberSystem& n)
      void add()
      Number getN1()
      Number getN2()
      Number getResult()
   private:
      int Number,n1,n2,result;
};
Well, the first four functions in NumberSystem are constructors. The first is when nothing is passed, the second is when one object of class Number is passed, the third is when two are passed, and the fourth is when the address of an object of type NumberSystem is passed. The three next functions that return an object of class Number simply get values for two numbers, and a result. The add function likely takes n1 and n2, adds them, and sticks the new value into result. This would likely be done through the getValue function.
What about class NumberSystem's private int Number. How can a class become an int?
No, no. That's just an integer with the same name as the class, which is a rather silly decision here due to the possible mistakes as a result.
Topic archived. No new replies allowed.