A few beginner's questions
I hail from C# and C++ is confusing me a lot.
1) I just got an error for putting the visibility identifier before the name of a method (at least I think that was the reason), so it's absolutely mandatory I use private: or public: and then put the methods and attributes after these declarations?
And private is standard, so I don't need to write it or?
2) I got an error for defining a method inside the class it belongs to (again, I think so), WTF?
How can you achieve data encapsulation when half the code of a class isn't part of it but defined globally?
In all the examples I've seen so far, it was done this way, is that mandatory or just optional?
And if it's mandatory, how do I write libraries and encapsulate classes in them, where am I supposed to define the methods, so that I can later just call them without any extra code?
3) Is there any kind of general exception I can catch, that at least tells me some vague info about what happened?
I only found specific exceptions and adding the throw(...) statement to add in a function's name, but this won't tell me jack about what happened.
4) The constructor of a class is called without using the new statement?
What do I use the new statement for? Only for arrays?
And that means just declaring a variable of a class (and structure/Union,too?) will allocate the necessary memory?
5) How do I convert from numbers/Boolean into strings and back, is there anything resembling Parse/TryParse functions from C#?
From what I've read, I can only think of outputting a number/bool into a stringstream and then inputting that back into a string. For the other way around I can only think inputting the string into the number/bool from a stringstream and then maybe using a nested try-catch block to check if it worked.
Thanks in advance.