Yes and no.
When you #ifndef MyClass, you are banking on MyClass being a unique name. If it's not and is already defined from some other include, then this header won't be included at all.
You need to #ifndef a unique symbol.
The most commonly used thing is a variation on the include file name. Since all headers included in a single build have to have unique names, you can use the header file name. I usually see things like:
-
//MyClass.h
-
-
#ifndef _MYCLASSH_
-
#define _MYCLASSH_
-
-
//etc...
-
-
#endif
-
The underscores are meant to separate your symbols from the user application symbols.
If you are packaging each class in its own header file and .cpp file, then you have a reasonable convention.