a class in a separate tab

I have a class that I’d like to set aside in a separate tab but when I try to instantiate an object of that class in the main tab e.g. setup() or loop() it doesn’t recognize the class (I think because it wants to see the class’s definition above the instantiation in the preceding code of the main tab).
Is there a way to tell it to just find the class in a different tab and stop having a problem about the sequence in which the class is defined?

did you include the header file (.h) for the class?

I don't have a header file. just a new tab. is there a way to have a class in a separate tab without a header file?

by tab you mean file, right?

if you intend to define a class, that definition/declaration needs to be known to the compiler when using class methods in other files.

unless the class is used solely in the file it is defined in, it is defined in a .h file. methods may be defined (not just declared) in the .h file or they may be defined in separate file(s) and only declared in the .h.

the irony of this approach is the .h describes most of the details of the class and must be shared instead of hidden. changes to the class affecting the .h definition requires rebuilding code outside of the class.

object oriented programming has been done in C (and many other language). Implementation is limited to a single file and changes don't require re-compiling other files when changed.

are you sure you really need to have class(s)? (see ken Thompson's comments re: C++)

I'm using the "v" button at the top right of the IDE to create a new tab and then defining my class there. so there is no .h file at all.

and yes, I really do need the class as I'm using it as a base class for others.

do you really need to use C++ classes?

(what did they every do w/o C++ classes)

I'm using a class and I'd like to compartmentalize it in a separate tab.

See Reply #3 Here.

Conventionally, you have a .h file that defines the class and a .cpp file that provides the implementation of the class.

Wherever you use the class, you have to include the .h file so that the compiler knows about it.

IIRC though, the IDE combines all your tabs into one file before passing it to the compiler. I think it does it in alphabetic order. Not sure about where the hidden main function appears.

If you're determined to achieve this without a header file, you might test the IDE and put your class in a.ino and see if compiles. If you do, beware that the behavior of the IDE might change in subsequent releases when you have forgotten this 'feature' and break something that has worked for ages.

wildbill: IIRC though, the IDE combines all your tabs into one file before passing it to the compiler. I think it does it in alphabetic order.

That's true for .ino files. It handles .h and .cpp files properly.

sounds like .h & .cpp is the way to go. I only have to include these files in the same directory as the .ino ? is there a way to use the IDE to work on, edit and save the .h & .cpp files without the IDE adding the .ino extension?