Error: private within this context (solved)

I made a hardware card with a 4x4 keypad using PCF8574A chip.

To make it easier to use in sketches I thought I should make a library. But when compiling it I get an error I cannot understand.

Any guru out there that can explain why and how I can resolve this problem?

C:\\Users\\dah\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10812 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\Users\\dah\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.3\\cores\\arduino" "-IC:\\Users\\dah\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.3\\variants\\standard" "-IC:\\Users\\dah\\Documents\\Arduino\\libraries\\TimedEventQueue\\src" "-IC:\\Users\\dah\\Documents\\Arduino\\libraries\\Board_2xPCF8574A\\src" "-IC:\\Users\\dah\\Documents\\Arduino\\libraries\\PCF8574" "-IC:\\Users\\dah\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.3\\libraries\\Wire\\src" "-IC:\\Users\\dah\\Documents\\Arduino\\libraries\\Board_4x4_keypad\\src" "-IC:\\Users\\dah\\Documents\\Arduino\\libraries\\Keypad_I2C" "-IC:\\Users\\dah\\Documents\\Arduino\\libraries\\Keypad\\src" "C:\\Users\\dah\\Documents\\Arduino\\libraries\\Board_4x4_keypad\\src\\Board_4x4_keypad.cpp" -o "C:\\Users\\dah\\AppData\\Local\\Temp\\arduino_build_728278\\libraries\\Board_4x4_keypad\\Board_4x4_keypad.cpp.o"
C:\Users\dah\Documents\Arduino\libraries\Board_4x4_keypad\src\Board_4x4_keypad.cpp: In constructor 'Board_4x4_keypad::Board_4x4_keypad(uint8_t)':

C:\Users\dah\Documents\Arduino\libraries\Board_4x4_keypad\src\Board_4x4_keypad.cpp:21:86: error: 'byte* Keypad::rowPins' is private within this context

 Board_4x4_keypad::Board_4x4_keypad(const uint8_t adr) : Keypad_I2C(makeKeymap(keys), rowPins, colPins, 4, 4, adr, W_PCF8574)

                                                                                      ^~~~~~~

In file included from C:\Users\dah\Documents\Arduino\libraries\Keypad_I2C/Keypad_I2C.h:35:0,

                 from C:\Users\dah\Documents\Arduino\libraries\Board_4x4_keypad\src\Board_4x4_keypad.h:10,

                 from C:\Users\dah\Documents\Arduino\libraries\Board_4x4_keypad\src\Board_4x4_keypad.cpp:7:

C:\Users\dah\Documents\Arduino\libraries\Keypad\src/Keypad.h:105:11: note: declared private here

     byte *rowPins;

           ^~~~~~~

Header file:

#ifndef BOARD_4x4_KEYAPD_PCF8574A_H_INCLUDED
#define BOARD_4x4_KEYAPD_PCF8574A_H_INCLUDED

#include <Keypad_I2C.h>
#include <Keypad.h>

class Board_4x4_keypad : public Keypad_I2C {
  private:
    uint8_t   m_adr;

  public:
    Board_4x4_keypad(const uint8_t adr);
    ~Board_4x4_keypad();
};

#endif

Source file:

#include "Board_4x4_keypad.h"

static char keys[4][4] = {
  {'1', '2', '3', 'A'},
  {'4', '5', '6', 'B'},
  {'7', '8', '9', 'C'},
  {'*', '0', '#', 'D'}
};

byte colPins[4] = {0, 1, 2, 3};
byte rowPins[4] = {4, 5, 6, 7};

Board_4x4_keypad::Board_4x4_keypad(const uint8_t adr) : Keypad_I2C(makeKeymap(keys), rowPins, colPins, 4, 4, adr, W_PCF8574)
{
  m_adr = adr;
}

Board_4x4_keypad::~Board_4x4_keypad()
{
}

I had an idea but not a good one. I'll try it out when I get my hands on a computer

which Keypad_I2C class are you using?

From the header file:

/*
||
|| @file Keypad_I2C.h
|| @version 2.0 - PCF8575 support added by Paul Williamson
|| @author G. D. (Joe) Young, ptw
|| @contact "G. D. (Joe) Young" <jyoung@islandnet.com>

Solved it:) ... at least the compilation errors are gone.

Header file:

:
class Board_4x4_keypad : public Keypad_I2C {
  private:
    uint8_t   m_adr;

    static byte colPins[4];
    static byte rowPins[4];
    
  public:
    Board_4x4_keypad(const uint8_t adr);
    ~Board_4x4_keypad();
};

CPP file:

static char keys[4][4] = {
  {'1', '2', '3', 'A'},
  {'4', '5', '6', 'B'},
  {'7', '8', '9', 'C'},
  {'*', '0', '#', 'D'}
};

byte Board_4x4_keypad::colPins[4] = {0, 1, 2, 3};
byte Board_4x4_keypad::rowPins[4] = {4, 5, 6, 7};

Board_4x4_keypad::Board_4x4_keypad(const uint8_t adr) : Keypad_I2C(makeKeymap(keys), rowPins, colPins, 4, 4, adr, W_PCF8574)
{
  m_adr = adr;
}

Board_4x4_keypad::~Board_4x4_keypad()
{
}

... just have to test it.