add a second class inside a library

Hi.

I am building a library with a couple of snippets. many of them a inside one class. but I want to create a new class inside the same file for some other function. is it possible ???

#ifndef snippets_H
#define snippets_H

#if (ARDUINO >= 100)
    #include "Arduino.h"
#else
    #include "WProgram.h"
#endif
#include <SD.h>

class snippets {
public:
	int funcDelay(int delay);
	String intToOnOff(byte inInt);
	String onOffBool(bool inBool);
	String toString(const char* inchar);
	bool stringToBool(const char* inChar);
	byte onOffToInt( const char* input);


private:



};


class backup {
public:
	backup();
	void init();
	void save(char* log);
private:

};

#endif

this code compile until I create an object of the second class

backup backup;

that sait backup doesn't name a type...

thanks

what happens when you include braces on your constructor...

class backup {
public:
	backup();
	void init();
	void save(char* log);

like this:

class backup {
public:
	backup(){};
	void init();
	void save(char* log);

you may not have the function defined outside the class (e.g. in an implementation *.cpp file).

same result...

compiles for me:

#include "snippets.h"

backup myBackup;


void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

.h file:

#ifndef snippets_H
#define snippets_H

#if (ARDUINO >= 100)
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
//#include <SD.h>

class snippets{
  
  public:
    snippets();
    int funcDelay(int delay);
    String intToOnOff(byte inInt);
    String onOffBool(bool inBool);
    String toString(const char* inchar);
    bool stringToBool(const char* inChar);
    byte onOffToInt( const char* input);

  private:

};

class backup{
  public:
    backup(){};
    void init();
    void save(char* log);
  private:

};

#endif

I had to comment out the SD line, couldn't compile with it.

hon... strange... just added capital to class name

Backup

and it is fix...

Delta_G:
Don't give your instance the same name as the class. That's bad too.

It is OK to the compiler, but it can be confusing to humans.

"OK to the compiler" means that you don't get any warnings even with -Wall -Wextra -pedantic.