1) if i create a class and make everything private, including the constructor, would the constructor still be called on when i create an instance of that class?
i've tried it myself and i got an error, but when i made the constructor public, it worked. does this mean that if i make a constructor private, i need a way to access it? but shouldn't constructor automatically be called on when an object is created regardless of whether it is public or private?
2) if i make a class header file, should the name of the header file match the name withint the ifndef guards? for example a header file named "circle.h" should the should i put #ifndef CIRCLE_H? or can i put something else like #ifndef ME_H?
do they have to be the same like stated previously?
1) As you noticed, constructors (and destructor) must be public in order for your program to work. Perhaps they should make constructors and destructor be public no matter what scope you declare them under...
2)
should the name of the header file match the name withint the ifndef guards?
No, name it any way you want :P If I have a file named "header.h" I usually do something like this:
No, that would prevent people from removing certain constructors (like the copy constructor).
How is that? I didn't quite get that :/ Could you explain?
EDIT: You mean to remove them intentionally for debugging purposes? To make them private so that the compiler generates an error when they are called? If that's what you mean you could just make the desired constructor output some text or something to know if it's called or not.
Declaring the copy constructor (and assignment operator) as protected and leaving them
unimplemented is a standard way to make an object non-copyable. See boost::noncopyable.
It is also useful for the singleton pattern.
The STL also uses protected constructors for things like iterators, because the containers
construct iterators in ways different from the user.