class MyNameClass { public: ... };
class MyNameClass { public: MyNameClass(): x(5) { } private: int x; };
int myVariableName;
void printFunction(void); void debugInfo();
MyNameClass, то названия файлов должны быть соответственно MyNameClass.h и MyNameClass.cc. Что касается оформления см. Оформление заголовочных файлов и Оформление cpp-файловNameHeaderFile_H_) Описание макросов лучше производить в заголовочном файле в начале (см. Оформление заголовочных файлов). Использование макросов не рекомендуется.const int MyConst; enum MyEnum { One, Two, Three };
function (void) { body of the function; if (a > b || a < c) { body of the condition; } else if (x > y) { body of the not condition; } }
if ( veryLongA > veryLongB )
{
body of the condition;
}
if (a>b)
{
}
veryLongA = veryLongB;
a=b;
PointerToObject* p;
ReferenceToObject& r;
/*************************************************************************** This file is part of the UniSet* library * Copyright (C) 2002 SET Research Institute. All rights reserved. * ***************************************************************************/ /**************************************************************************/ #ifndef MyNameClass_H_ #define MyNameClass_H_ #include <std.h> #include <...> #include "myInclude.h" #include "..." // ----------------------------------------------------------------------- #define MY_DEFINE (x) x // ----------------------------------------------------------------------- const float MyPI = 3.14; enum MyEnum { En1, En2, En3 }; // ----------------------------------------------------------------------- class MyNameClass { public: ... protected: ... private: ... }; #endif
/*************************************************************************** This file is part of the UniSet* library * Copyright (C) 2002 SET Research Institute. All rights reserved. * ***************************************************************************/ /**************************************************************************/ #include <std.h> #include <...> #include "MyNameClass.h" #include "..." // ----------------------------------------------------------------------------------------- void MyNameClass::func1(void) { ... } // ----------------------------------------------------------------------------------------- void MyNameClass::func2(void) { ... } // ----------------------------------------------------------------------------------------- ... // -----------------------------------------------------------------------------------------
Пример:
interface BaseProcess_i
{
...
}
class BaseProcess: public POA_BaseProcess_i, public ... { ... }
class ControlProcess: public BaseProcess, public POA_ControlProcess_i { ... }
1.5.9