i need help in using classes in arduino

i need help in using classes in arduino
i want to know how to use classes in arduino
*hint : i have read the how to make a library tutorial
but i wanna ask can i just declare the class in the predefinition area as we do with functions or declare it anywhere else
or i have to make new files as the library
and if i have to make new files can you give me clear steps how to make and where to put theses files

Normally the class definition is in a *.h file and the functions are in a *.ccp file.
In the Arduino IDE is a drop-down menu on the upper-right. You can use that to create new files.

A simple class is a few functions, and a few variables. The variables are often private.
Write the class in the *.h file and the function in the *.cpp file.

Check the EEPROM class, very simple : https//github.com/arduino/Arduino/tree/master/libraries/EEPROM
Do you see this: EEPROMClass EEPROM;
and this: extern EEPROMClass EEPROM;
That is because the class is being declared. Normally that would be done in the sketch.

More advanced is the LiquidCrystal class with private functions and private variables : https://github.com/arduino/Arduino/tree/master/libraries/LiquidCrystal

i dont want to make a library
i want to use classes as function by declaration in the same arduino code file (is this possible)

Yes, use that code I showed you (the EEPROM and CrystalLibrary *.h and *.cpp files) and put it all in the same Arduino file.
First the definition, and all the functions below that.
I think the definition of the class must be on top, before the setup() and loop().

After some time, you want to put those in a seperate *.h and *.cpp files anyway :stuck_out_tongue:
When you add those *.h and *.cpp files to your project (using the drop down menu), you don't have a library. They will be just files in your project.

Peter_n:
I think the definition of the class must be on top, before the setup() and loop().

Yes, you are correct. If setup or or loop do not use the class its fine to place it underneath, just before the functions that do.

C/C++ compiles from top to bottom, so the class must be declared before its functions are defined externally, and before the code that uses the actual class.