Question: I am making my first steps in learning OOP . And here is the first problem which I can't solve.
The max function in this class should return the maximum of two numbers . I want to keep the numbers in the private scope and the functions in the public scope . But when I want to use variables from `struct data{}` in the public scope the compiler says that the variables are not declared . Please tell me why I get these errors . 

```
class myclass{
private:
   struct data{
       int q ;
       int w;
   };

public:
   void get(int a, int b){
      struct data = {a , b}; // here I want to pass the variables to data struct
   }
   int max (){              // this function returns the biggest number 
      if(q>w)
         return q;
         else 
            return w;
   } 

};

```

Answer: 
```
struct data{
    int q ;
    int w;
};

```

only declares a *type*, not an *object*, so there are no `q` and `w` members anywhere inside your `class` instances. You need the declare an *instance* of the `struct`:

```
struct {
     int q;
     int w;
} data;

```

Then, you can write `max` as:

```
int max()
{
    if (data.q > data.w)
        return data.q;
    else 
        return data.w;
}

```

(I've no idea what your `get` method is supposed to do, so I have no replacement for that.)
You have defined the structure but there is no object of that type. You should declare an object and you will not get any error.

```
class myclass{
private:
   struct data{
       int q ;
       int w;
   }var;

public:
   void get(int a, int b){
     var .q= a;
    var.w=b; // here I want to pass the variables to data struct
   }
   int max (){              // this function returns the biggest number 
      if(var.q>var.w)
         return var.q;
         else 
            return var.w;
   } 

};

```