[answered] N00B questions about classes and library

After many years of not bothering to try to understand these arcane things, I'm looking at using classes and libraries. Been messing around and have blink without delay now working in a class and about to transfer it to a library.

Two questions so far:

  • What was the rationale of the C++ designers behind a class definition needing the ; after the closing }?
  • Can I have many classes in a library? A library "shapes" could for example need classes "circle" and "square".... or would I need a library "circle" with class "circle" and library "square" with class "square"?

First is the same as for union/struct/enum. You can create objects right after the class definition.

class myTest{
  //class stuff here
} firstObject, secondObject;

Second, yes you can. The Adafruit LEDbackpack library is an example of that. It has classes for 7 different ledpacks in it.

Thanks