0
Got two questions
#1 Should constructors be under public? #2 Do I include header file of another class (in composition) in the header of the class I'm using it in?
1 ответ
+ 1
#1 Usually constructors are public, because if they are private, you wouldn't be able to instantiate any objects of that class due to a call to a private member from outside the class.
However, I say "usually" because there are specific patterns or classes that make use of this, for example:
https://www.sololearn.com/learn/713/?ref=app
So they don't necessarily must be public, it comes down to what you need.
Regarding #2: Yes, if you want to use a class in another file of your project, you have to include its header file in that file, otherwise the compiler doesn't know what that data type is.