aboutsummaryrefslogtreecommitdiffstats
path: root/it/it-projects/plugins/project/src/cpp/SimpleClass.cc
diff options
context:
space:
mode:
authorDavid Gageot <david@gageot.net>2015-07-22 09:43:54 +0200
committerDavid Gageot <david@gageot.net>2015-07-22 13:55:37 +0200
commit4b23bd740da7cc0b7ccfd815c310ada6e86cb8b0 (patch)
tree9187838e517a9430bae712671a4ff326e22bee4a /it/it-projects/plugins/project/src/cpp/SimpleClass.cc
parent95439601477588ba93f5772e16c6fe63b593ccc3 (diff)
downloadsonarqube-4b23bd740da7cc0b7ccfd815c310ada6e86cb8b0.tar.gz
sonarqube-4b23bd740da7cc0b7ccfd815c310ada6e86cb8b0.zip
Configure plugin ITs (aka it-platform)
Diffstat (limited to 'it/it-projects/plugins/project/src/cpp/SimpleClass.cc')
-rw-r--r--it/it-projects/plugins/project/src/cpp/SimpleClass.cc70
1 files changed, 70 insertions, 0 deletions
diff --git a/it/it-projects/plugins/project/src/cpp/SimpleClass.cc b/it/it-projects/plugins/project/src/cpp/SimpleClass.cc
new file mode 100644
index 00000000000..4f4ceba3aae
--- /dev/null
+++ b/it/it-projects/plugins/project/src/cpp/SimpleClass.cc
@@ -0,0 +1,70 @@
+// DateClass.cc
+// Program to demonstrate the definition of a simple class
+// and member functions
+
+#include <iostream>
+using namespace std;
+
+
+// Declaration of Date class
+class Date {
+
+public:
+ Date(int, int, int);
+ void set(int, int, int);
+ void print();
+
+private:
+ int year;
+ int month;
+ int day;
+};
+
+
+int main()
+{
+ // Declare today to be object of class Date
+ // Values are automatically intialised by calling constructor function
+ Date today(1,9,1999);
+
+ cout << "This program was written on ";
+ today.print();
+
+ cout << "This program was modified on ";
+ today.set(5,10,1999);
+ today.print();
+
+ return 0;
+}
+
+// Date constructor function definition
+Date::Date(int d, int m, int y)
+{
+ if(d>0 && d<31) day = d;
+ if(m>0 && m<13) month = m;
+ if(y>0) year =y;
+}
+
+// Date member function definitions
+void Date::set(int d, int m, int y)
+{
+ if(d>0) {
+ if (d<31){
+ if(m>0) {
+ if (m<13) {
+ if(y>0) {
+ year =y;
+ month = m;
+ day = d;
+ }
+ }
+ }
+ }
+ }
+}
+
+void Date::print()
+{
+ cout << day << "-" << month << "-" << year << endl;
+}
+