Declaring classes inside classes. Im confused!

Hi, im new here so please dont be angry with me if this a dumm question.

So I want to create a library and inside it to declare servos and attach them.

Kinda like this:


Spider.h:

#ifndef Spider_h
#define Spider_h

#include "Arduino.h"
#include "Servo.h"

class Spider
{
public:
Spider();
void Attach();
private:

};

#endif


Spider.cpp:

#include "Arduino.h"
#include "Servo.h"
#include "Spider.h"

Spider::Spider()
{
Servo SL1A;
Servo SL1B;
Servo SL1C;
}
void Spider::Attach()
{

SL1A.attach(22);
SL1B.attach(23);
SL1C.attach(24);

}


and then be able to do smth like this:

#include <Servo.h>
#include <Spider.h>
Spider X;

void setup()
{
X.Attach();
}

and then i could be able to control the servos like normal servo objects like so:

SL1A.write(90);

Is there a way for this to happen?
Cause I get an error that I havent declared SL1A-B-C in this scope.

Thanks in advance,

Try removing these declarations from the constructor of Spider ...

  Servo SL1A;
   Servo SL1B;
   Servo SL1C;

... and instead put them in the spider.h file:

class Spider
{
  public:
    Spider();
    void Attach();
  private:
    Servo SL1A; // private members since assumed you will not want to access from outside the class
    Servo SL1B;
    Servo SL1C;

};