How do I call an array in FastLed from my class?

This is my code in my library, simplified...

class MyLed {


  public:
    MyLed(int ledID);
    void update();

  private:
    int thisLedID;
};

MyLed::MyLed( int ledID )
{

    thisLedID = ledID;

}

void MyLed::update() {

        leds[thisLedID] = CRGB::Black; // this makes error

        FastLED.show();

}

error: 'leds' was not declared in this scope.

the array is declared in the Arduino Sketch itself and I hoped it would know what to do, but it doesn't. Does it need pointers? I don't know how to implement it.

thanks for any help! :)

Things inside classes are private by default. Your options are either to make them public, or write a public function to access them. The second of those options is usually the 'proper' way.

EDIT - sorry everyone. I misunderstood the question. See reply #3

Should I write the public function actually inside the FastLed library? cheers

GypsumFantastic:
Things inside classes are private by default.

Your options are either to make them public, or write a public function to access them.

The second of those options is usually the ‘proper’ way.

First, you should always post an MCVE so that people can take your code, put it in the Arduino IDE, and reproduce your problem.

Otherwise, take your question over to snippets-r-us.

Byte3: Does it need pointers?

Yes:

#include "FastLED.h"

class MyLed {
  public:
    MyLed(int ledID, CRGB *p );
    void update();

  private:
    int thisLedID;
    CRGB *ledPtr;
};

MyLed::MyLed(int ledID, CRGB *p) : thisLedID(ledID), ledPtr(p) {}

void MyLed::update() {
  ledPtr[thisLedID] = CRGB::Black;
  FastLED.show();
}

CRGB leds[10];
MyLed m(1, leds);

void setup() {
  m.update();
}

void loop() {}

Thanks gfvalvo, and I aim to improve my posts.

gfvalvo:
First, you should always post an MCVE so that people can take your code, put it in the Arduino IDE, and reproduce your problem.

Otherwise, take your question over to snippets-r-us.
Yes:

#include "FastLED.h"

class MyLed {
  public:
    MyLed(int ledID, CRGB *p );
    void update();

private:
    int thisLedID;
    CRGB *ledPtr;
};

MyLed::MyLed(int ledID, CRGB *p) : thisLedID(ledID), ledPtr(p) {}

void MyLed::update() {
  ledPtr[thisLedID] = CRGB::Black;
  FastLED.show();
}

CRGB leds[10];
MyLed m(1, leds);

void setup() {
  m.update();
}

void loop() {}