The simple answer is that class names are capital in general in C ++ (except for std classes), methods are lowercase, some frameworks like Qt prefer camelCase, but I prefer underscore_notation - and for example, STL see for example. "Auto_ptr".
Classes do not always have separate .h files, because here the .java file is divided into the .h header (for the whole package) and the .cpp implementation files, one per class.
class TipicalCamelCase { public:
Some implementations / initializations (usually in a separate TipicalCamelCase.cpp file):
const int TipicalCamelCase::one = 1; int TipicalCamelCase::getMyAge() const{ return myAge; } void TipicalCamelCase::setMyAge(int myAge_){ myAge = myAge_; }
The underline style is the same, but
int Tipical_camel_case::get_my_age() const { return my_age; }
I prefer this because it looks cleaner both in the header and in the implementation files. You can see that the function headers are longer than in java. Especially you will see that the templates (generics) header of 2 lines is typical, so it’s worth a little separation.
template<typename _Tp> int Class_name::general_function(_Tp);
I think it should be like an introduction to style. If you use inheritance, to work in java style, check every function except virtual constructors so that @overrides rules work correctly.
source share