So I've discovered something to do with defining private variables in a class.

At the moment, my Apple.h file looks like this:

```
#ifndef Apples_h
#define Apples_h

class Apples {
    public:
        Apples();
        void eat();
        void peel();
        void slice();

    private:
        int _seeds;
        String _type; // originally int by mistake
};

#endif

```

My Apple.cpp file looks like this:

```
#include "Apples.h"

int _seeds = 0; // default
String _type = 0; // default

Apples::Apples(){
    _seeds = 5000;
    _type = "notYummy";
}

// pretend all the public methods are implemented and are fine (no issues with them)

```

This actually works fine: I have defined a private property \_seeds in my header and .cpp file.

The problem arises when I define a property \_seeds somewhere else, say in a parent class/main file.

It then complains that there are multiple definitions of it. To me, this is a bit strange as I am thinking that the \_seeds property inside Apple.cpp should be private (and thus unknown), but it somehow picks it up and clashes in another file.

I looked for an example of making classes, and they had it where they did not define the class properties inside the .cpp file, but only in the header file and it just seems to magically creates those private properties in the .cpp file (they aren't defined anywhere in the .cpp file).

My "closest" language is probably Java and for there I define all the class variables/properties in the class implementation file, so I'm a bit confused.

Can anyone confirm that:

1. This is not the case for c/c++ and that you should only define private properties in the header file.
2. any variables/properties inside the class .cpp file are some how in a 'global namespace' where they can collide in other files.

And that if the second point is true, could they be actually accessed by just calling \_seeds in another class/file?

(It probably doesn't matter as I think this is just a language thing, but this is code for an arduino.)