#include <LiquidCrystal.h>

class DisplayText   // Object for displaying on a lcd screen
{
  public:
    LiquidCrystal lcd;

    DisplayText(int pinRS, int pinE, int pin0, int pin1, int pin2, int pin3)
      : lcd(pinRS, pinE, pin0, pin1, pin2, pin3)
    {}

    void begin()
    {
      lcd.begin(16, 2);
      lcd.clear();
      lcd.setCursor(0, 0);
    }
};


class DisplayManager   // manages various display types (currently only text lcds
{
  public:

    DisplayText *Displays;
    unsigned displayCount;

    void begin()
    {
      for (unsigned i = 0; i < displayCount; i++)
        Displays[i].begin();
    }

    DisplayManager(byte _textLCDs[][6], const unsigned count) : displayCount(count)
    {
      // allocates memory for number of lcds based on array of pins
      Displays = (DisplayText *) malloc(sizeof (DisplayText) * displayCount);

      for (unsigned i = 0; i < displayCount; i++)
      {
        Displays[i] = DisplayText(
          _textLCDs[i][0],
          _textLCDs[i][1],
          _textLCDs[i][2],
          _textLCDs[i][3],
          _textLCDs[i][4],
          _textLCDs[i][5]); // initialize each lcd
      }
    }
};

byte textLCDsSetup[][6] =
{
  { 52, 48, 36, 34, 32, 30 }
};

const unsigned DisplayCount = sizeof textLCDsSetup / sizeof textLCDsSetup[0];

DisplayManager manager(textLCDsSetup, DisplayCount); // initialize manager

void setup()
{
  manager.begin(); // Initialize displays

  // Put text on the first display
  manager.Displays[0].lcd.print("test2");
}

void loop() {}