Ajout de l'ensemble du workspace.
[GPU.git] / WCudaMSE / Tuto_NameSpaces / src / cpp / core / namespace / 01_procedures / useNameSapceProcedures.cpp
diff --git a/WCudaMSE/Tuto_NameSpaces/src/cpp/core/namespace/01_procedures/useNameSapceProcedures.cpp b/WCudaMSE/Tuto_NameSpaces/src/cpp/core/namespace/01_procedures/useNameSapceProcedures.cpp
new file mode 100755 (executable)
index 0000000..6e1b8b2
--- /dev/null
@@ -0,0 +1,75 @@
+#include <iostream>\r
+\r
+using std::cout;\r
+using std::endl;\r
+\r
+/*----------------------------------------------------------------------*\\r
+ |*                    Declaration                                     *|\r
+ \*---------------------------------------------------------------------*/\r
+\r
+/*--------------------------------------*\\r
+ |*            Public                  *|\r
+ \*-------------------------------------*/\r
+\r
+void useNameSpaceProcedure();\r
+\r
+/*--------------------------------------*\\r
+ |*            Private                 *|\r
+ \*-------------------------------------*/\r
+\r
+namespace v1\r
+    {\r
+    static int V = 1;\r
+\r
+    static float value();\r
+    }\r
+\r
+namespace v2\r
+    {\r
+    static int V = 2;\r
+\r
+    static float value();\r
+    }\r
+\r
+/*----------------------------------------------------------------------*\\r
+ |*                    Implementation                                  *|\r
+ \*---------------------------------------------------------------------*/\r
+\r
+/*--------------------------------------*\\r
+ |*            Public                  *|\r
+ \*-------------------------------------*/\r
+\r
+void useNameSpaceProcedure()\r
+    {\r
+    cout << endl<<"[Using Namespaces with procedures] :" << endl<<endl;\r
+    float v1 = v1::value();\r
+    float v2 = v2::value();\r
+\r
+    cout << "value of v1 = " << v1 << " V = " << v1::V << endl;\r
+    cout << "value of v2 = " << v2 << " V = " << v2::V << endl;\r
+    }\r
+\r
+/*--------------------------------------*\\r
+ |*            Private                 *|\r
+ \*-------------------------------------*/\r
+\r
+/**\r
+ * v1 est le name space\r
+ */\r
+float v1::value()\r
+    {\r
+    return 1.0f;\r
+    }\r
+\r
+/**\r
+ * v2 est le name space\r
+ */\r
+float v2::value()\r
+    {\r
+    return 2.0f;\r
+    }\r
+\r
+/*----------------------------------------------------------------------*\\r
+ |*                    End                                             *|\r
+ \*---------------------------------------------------------------------*/\r
+\r