Extending class error

Hi, I have 3 declaration headers in my project, A base class that has extended class 2 and 3, from my base class im able to use class 2 and 3s functions no problem but my Small serial class which is class 2 isnt able to use class 3s functions or the other way about. I havent made any implementation file just now and have kept everything in the dec files because the code is still small enough.

I have extended class 2 using

#include "Class 3"
class class2 : public class3
{
}

but its giving me errors like Reference to (class 2 function) is ambiguous or expected class name before token }

When I preview post it says 9500 max allowed so i split into 3 posts
Here is the code im using, I have commented out the areas that are causing errors in the dec files.

MAIN

#include <SHT1x.h>
#include <WProgram.h>
#include <DS1307.h>
#include <Wire.h>
#include "DataICLASS.h"
#include "EpromManager.h"
#include "DATACOMM.h"

DataI id;

void setup(){
  Serial.begin(9600);  
}

void loop()
{  
  id.DATA_CATCH();
  id.DATA_SORT();
  id.DATA_SEND();
}

BASECLASS (i think :))

#ifndef DataICLASS_h
#define DataICLASS_h
#include <WProgram.h>
#include "EpromManager.h"
#include "DATACOMM.h"
#include <DS1307.h>

#include <DS1307.h>
#include <SHT1x.h>
#include <Wire.h>


#define dataPin  10
#define clockPin 11
SHT1x sht1x(dataPin, clockPin);


class DataI : public EpromManager, DATACOMM
{
  private:
  int TEMP_C;
  int TEMP_F;
  int LDR;
  int RHUM;
  int MAXTEMPC, MINTEMPC, MAXRH, MINRH;
  int DAY,MONTH,YEAR,HOURS,MINUTES;
  int Array[36];
  int mappedtemp;
  int mappedrh;
  
  public:
  DataI()
  {
  }
 
  
  int DATA_CATCH()
  {
    TEMP_C = sht1x.readTemperatureC();
    TEMP_F = (9/5) * TEMP_C + 32;
    RHUM = sht1x.readHumidity();
    LDR = analogRead(A0);
    mappedtemp = (int)map(TEMP_C, 0, 60, 0, 150);
    mappedrh = (int)map(RHUM, 0, 100, 0, 150);
  }
  
  int DATA_SEND()
  {
    Array[0] = TEMP_C;
    Array[1] = TEMP_F;
    Array[2] = RHUM;
    Array[3] = RTC.get(DS1307_DATE,false);
    Array[4] = RTC.get(DS1307_MTH,false);
    Array[5] = RTC.get(DS1307_YR,false);
    Array[6] = RTC.get(DS1307_HR,true);
    Array[7] = RTC.get(DS1307_MIN,true);
    Array[8] = LDR;
    Array[9] = 9999;
    Array[10] = mappedtemp;
    Array[11] = mappedrh;
    Array[12] = MAXTEMPC;
    Array[13] = MINTEMPC;
    Array[14] = (9/5) * MAXTEMPC + 32; 
    Array[15] = (9/5) * MINTEMPC + 32;
    Array[16] = MAXRH;
    Array[17] = MINRH;
    Array[18] = 0;
    Array[19] = 0;
    Array[20] = 0;
    Array[21] = 0;
    Array[22] = 0;
    Array[23] = 0;
    Array[24] = 0;
    Array[25] = 0;
    Array[26] = 0;
    Array[27] = 0;
    Array[28] = 0;
    Array[29] = 0;
    Array[30] = 0;
    Array[31] = 0;
    Array[32] = 0;
    Array[33] = 0;
    Array[34] = 0;
    Array[35] = 0;
    Array[36] = 0;
    Array[37] = 0;
    SENDDATA(Array); 
    return 0;
  }
  int DATA_SORT()
  {
    if(TEMP_C > MAXTEMPC)
    {
      Set_MaxTempC(TEMP_C);
    }
    if(TEMP_C < MINTEMPC)
    {
      Set_MinTempC(TEMP_C);
    }
    if(RHUM > MAXRH)
    {
      Set_MaxRH(RHUM);
    }
    if(RHUM < MINRH)
    {
      Set_MinRH(RHUM);
    }
    return 0;
  }
  
};

#endif

Still above 9500 3rd post

CLASS1

#ifndef DATACOMM_h
#define DATACOMM_h
//#include "Eprommanager.h"

class DATACOMM// : public Eprommanager
{
  
  public:
  DATACOMM()
  {
  }
  void SENDDATA(int b[])
  {
    for(int i = 0; i < 38; i++)
    {
      Serial.print(b[i], DEC); if(i < 37){ Serial.print(",");}
    }
    Serial.println("*");
  } 
  
  void CHECKSERIAL()
  {
    byte iByte;
    if(Serial.available() != 0)
    {
      iByte = Serial.read();
      if(iByte == 1)
      {
        //Reset_Data();
        //Serial.flush();
      }
      if(iByte == 2)
      {
        //Do Something
        Serial.flush();
      }
        
    }
  }

  
};

#endif

CLASS2

#ifndef EpromManager_h
#define EpromManager_h
#include <Wire.h>
#include <Wprogram.h>
#include <DS1307.h>
//#include "DATACOMM.h"

class EpromManager// : public DATACOMM
{
  private:
  int CounterT;
  int CounterR;
  
  public:
  EpromManager(){
    CounterT = 0;
    CounterR = 0;
  }
  int Get_CounterT(){return CounterT;}
  void Set_CounterT(int v){CounterT = v;}
  int Get_CounterR(){return CounterR;}
  void Set_CounterR(int v){CounterR = v;}
  
  //Set Vars for 7 days graphing, data collected every 5 minutes.
  void Set_TempC(int v)
  {
    //Write max temp to EEprom correct address
    if(CounterT = 2016)
    {
      CounterT = 0;
      CounterR = 0;
    }
    else
    {
      CounterT++;
      CounterR++;
    }
  }
  int Get_TempC(int address)
  {
    int v;
    //Read EEprom address for max temp and return
    return v;
  }
  void Set_RH(int v)
  {
    //Write to eeprom correct address
  }
  int Get_RH(int address)
  {
    int v;
    //Read EEprom address and return
    return v;
  }
  //End Graphing Var
  
  //MaxTemp, Time and date
  void Set_MaxTempC(int v)
  {
    //Write to max temp address on epprom
    Set_MaxTempCDate();
    Set_MaxTempCTime();
  }
  int Get_MaxTempC()
  {
    int v;
    //Read eeprom max temp c address and return
    return v;
  }
  void Set_MaxTempCDate()
  {
    int day = RTC.get(DS1307_DATE,true);
    int month = RTC.get(DS1307_MTH,true);
    //Write to Maxtemp day/month address on eeprom
  }
  void Set_MaxTempCTime()
  {
    int hours = RTC.get(DS1307_HR,true);
    int minutes = RTC.get(DS1307_MIN,true);
    //Write to maxtemp hours/minutes address on eeprom
  }
  int Get_MaxTempCDate(int type)
  {
    int v;
    if(type == 1)
    {
      //read Maxtemp day address on eeprom and return
      return v;
    }
    else if(type == 2)
    {
      //read Maxtemp month address on eeprom and return
      return v;
    }
    else
    {
      return 0;
    }
  }
  int Get_MaxTempCTime(int type)
  {
    int v;
    if(type == 1)
    {
      //read Maxtemp hours address on eeprom and return
      return v;
    }
    else if(type == 2)
    {
      //read Maxtemp minutes address on eeprom and return
      return v;
    }
    
    return 0;
  }
  
  //End MaxTempCTime and Date
  
  //MaxRH time and date vars
   void Set_MaxRH(int v)
  {
    //Write to max temp address on epprom
  }
  int Get_MaxRH()
  {
    int v;
    //Read eeprom max rh address and return
    return v;
  }
  void Set_MaxRHDate()
  {
     int day = RTC.get(DS1307_DATE,true);
     int month = RTC.get(DS1307_MTH,true);
    //Write to MaxRH day/month address on eeprom
  }
  void Set_MaxRHTime()
  {
    int hours = RTC.get(DS1307_HR,true);
    int minutes = RTC.get(DS1307_MIN,true);
    //Write to maxRH hours/minutes address on eeprom
  }
  int Get_MaxRHDate(int type)
  {
    int v;
    if(type == 1)
    {
      //read MaxRH day address on eeprom and return
      return v;
    }
    else if(type == 2)
    {
      //read MaxRH month address on eeprom and return
      return v;
    }
    else
    {
      return 0;
    }
  }
  int Get_MaxRHTime(int type)
  {
    int v;
    if(type == 1)
    {
      //read MaxRH hours address on eeprom and return
      return v;
    }
    else if(type == 2)
    {
      //read MaxRH minutes address on eeprom and return
      return v;
    }
    
    return 0;
  }
  
  //  MIN TEMPC and RH
  //MIN Temp, Time and date
  void Set_MinTempC(int v)
  {
    //Write to min temp address on epprom
  }
  int Get_MinTempC()
  {
    int v;
    //Read eeprom min temp c address and return
    return v;
  }
  void Set_MinTempCDate()
  {
    int day = RTC.get(DS1307_DATE,true);
    int month = RTC.get(DS1307_MTH,true);
    //Write to Mintemp day/month address on eeprom
  }
  void Set_MinTempCTime()
  {
    int hours = RTC.get(DS1307_HR,true);
    int minutes = RTC.get(DS1307_MIN,true);
    //Write to mintemp hours/minutes address on eeprom
  }
  int Get_MinTempCDate(int type)
  {
    int v;
    if(type == 1)
    {
      //read Mintemp day address on eeprom and return
      return v;
    }
    else if(type == 2)
    {
      //read Mintemp month address on eeprom and return
      return v;
    }
    else
    {
      return 0;
    }
  }
  int Get_MinTempCTime(int type)
  {
    int v;
    if(type == 1)
    {
      //read Mintemp hours address on eeprom and return
      return v;
    }
    else if(type == 2)
    {
      //read Mintemp minutes address on eeprom and return
      return v;
    }
    
    return 0;
  }
  
  //End MinTempCTime and Date
  
  //MinRH time and date vars
  void Set_MinRH(int v)
  {
    //Write to min temp address on epprom
  }
  int Get_MinRH()
  {
    int v;
    //Read eeprom min rh address and return
    return v;
  }
  void Set_MinRHDate()
  {
    int day = RTC.get(DS1307_DATE,true);
    int month = RTC.get(DS1307_MTH,true);
    //Write to MinRH day/month address on eeprom
  }
  void Set_MinRHTime()
  {
    int hours = RTC.get(DS1307_HR,true);
    int minutes = RTC.get(DS1307_MIN,true);
    //Write to minRH hours/minutes address on eeprom
  }
  int Get_MinRHDate(int type)
  {
    int v;
    if(type == 1)
    {
      //read MinRH day address on eeprom and return
      return v;
    }
    else if(type == 2)
    {
      //read MinRH month address on eeprom and return
      return v;
    }
    else
    {
      return 0;
    }
  }
  int Get_MinRHTime(int type)
  {
    int v;
    if(type == 1)
    {
      //read MinRH hours address on eeprom and return
      return v;
    }
    else if(type == 2)
    {
      //read MinRH minutes address on eeprom and return
      return v;
    }
    
    return 0;
  } 
  //Reset Data Function
  void Reset_Data()
  { 
    Set_MaxTempC(0);
    Set_MaxRH(0);
    Set_MinTempC(100);
    Set_MinRH(100);
    Set_MaxTempCDate();
    Set_MaxTempCTime();
    Set_MinTempCDate();
    Set_MinTempCTime();
    Set_MaxRHDate();
    Set_MaxRHTime();
    Set_MinRHDate();
    Set_MinRHTime();
    
  }
};

#endif

Some pointers would be nice.

class class2 : public class3
{
};

The base class is the one that is derived FROM. So, you have 2 base classes - DATACOMM and EpromManager. You have one class that derives from both of them - DataI.

So, now that we have the terminology straight...

but its giving me errors like Reference to (class 2 function) is ambiguous or expected class name before token }

Quit with the handwaving and show the EXACT error message(s).

Why is SENDDATA (trying to) print all 38 elements of the 36 element array passed to it?

@Awol I tried not putting #include in the class 2 header and it still threw up an error

In file included from sketch_aug04a.cpp:19:
/DataICLASS.h: In member function 'int DataI::DATA_SORT()':
DataICLASS.h:96: error: reference to 'Set_MaxTempC' is ambiguous
EpromManager.h:65: error: candidates are: void EpromManager::Set_MaxTempC(int)
EpromManager.h:65: error: void EpromManager::Set_MaxTempC(int)
DataICLASS.h:96: error: reference to 'Set_MaxTempC' is ambiguous
EpromManager.h:65: error: candidates are: void EpromManager::Set_MaxTempC(int)
EpromManager.h:65: error: void EpromManager::Set_MaxTempC(int)
DataICLASS.h:100: error: reference to 'Set_MinTempC' is ambiguous
EpromManager.h:186: error: candidates are: void EpromManager::Set_MinTempC(int)
EpromManager.h:186: error: void EpromManager::Set_MinTempC(int)
DataICLASS.h:100: error: reference to 'Set_MinTempC' is ambiguous
EpromManager.h:186: error: candidates are: void EpromManager::Set_MinTempC(int)
EpromManager.h:186: error: void EpromManager::Set_MinTempC(int)
DataICLASS.h:104: error: reference to 'Set_MaxRH' is ambiguous
EpromManager.h:127: error: candidates are: void EpromManager::Set_MaxRH(int)
EpromManager.h:127: error: void EpromManager::Set_MaxRH(int)
DataICLASS.h:104: error: reference to 'Set_MaxRH' is ambiguous
EpromManager.h:127: error: candidates are: void EpromManager::Set_MaxRH(int)
EpromManager.h:127: error: void EpromManager::Set_MaxRH(int)
DataICLASS.h:108: error: reference to 'Set_MinRH' is ambiguous
EpromManager.h:246: error: candidates are: void EpromManager::Set_MinRH(int)
EpromManager.h:246: error: void EpromManager::Set_MinRH(int)
DataICLASS.h:108: error: reference to 'Set_MinRH' is ambiguous
EpromManager.h:246: error: candidates are: void EpromManager::Set_MinRH(int)
EpromManager.h:246: error: void EpromManager::Set_MinRH(int)

@Pauls Thanks for the terminology correction, when i start Uni this year it will come in handy. Im not handwaving, maybe i programmed SENDDATA to do so.

Did you put in the semicolon that was missing in your earlier post, that I added to my post?

sorry awol i forgot on that one, in the code the colon is present.

I copied your code into Arduino 0022, ant tried to compile and link it. I got a lot off errors, all having to do with the DataI and EpromManager classes not having access to the RTC object.

I commented all uses of the RTC object, and everything compiled. I'm using Win7 64 bit, and 0022, if that matters.

Thats strange Paul as it compiles on mine and gives me access to RTC data which i send to processing app, i havent really delved into the eeprom manager as I dont have an eeprom until tomorrow which ill need to wireup and test, I just set out a small template in the meantime. The Eprom dec file has #include <DS1307.h> so why would it throw up an error? Do i have to make an instance of an RTC object and pass it about?

What i was wanting to do with regards to my original post was to run CHECKSERIAL() from DATACOMM.h that checks if anything has been sent by processing, if it has then it runs Reset_Data() from the eeprom manager class which in turn runs a few functions to reset the max/min values to the present parameters. using the classes I have how can I do this?

regards

Do i have to make an instance of an RTC object and pass it about?

Yes. If you don't, the header file will be ignored, and might as well not be there.

What i was wanting to do with regards to my original post was to run CHECKSERIAL() from DATACOMM.h

Since the DataI class derives from DATACOMM, the id object has a CHECKSERIAL method. Just call it:

id.CHECKSERIAL();

By convention, function names use either camel case or Pascal case notation. Each word in the function starts with a capital letter, except maybe the first. Notice that the Arduino has functions like analogWrite, digitalRead, etc.? So, your CHECKSERIAL() function should be called checkSerial (camel case) or CheckSerial (Pascal case).

All capital letters are, by convention, reserved for #define names.