We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dca4e48 commit 63d99efCopy full SHA for 63d99ef
cpp/OOP/encapsullation/main.cpp
@@ -0,0 +1,35 @@
1
+#include <iostream>
2
+using namespace std;
3
+//encapsullation
4
+
5
+class dikdortgen{
6
+ private:
7
+ int en;
8
+ int boy;
9
+ public:
10
+ int alan();
11
+ int cevre();
12
+ //
13
+ int getEn();
14
+ void setEn(int e);
15
+ int getBoy();
16
+ void setBoy(int b);
17
+};
18
+int dikdortgen::alan(){
19
+ return en*boy;}
20
+int dikdortgen::cevre(){
21
+ return ((en+boy)*2);}
22
+//
23
+int dikdortgen::getEn(){ return en; }
24
+int dikdortgen::getBoy(){ return boy; }
25
+void dikdortgen::setEn(int e){ en=e; }
26
+void dikdortgen::setBoy(int b){ boy=b; }
27
28
+int main(){
29
+ dikdortgen d1;
30
+ d1.setEn(5);
31
+ d1.setBoy(10);
32
33
+ cout<<"Alan :"<<d1.alan()<<endl;
34
+ cout<<"cevre :"<<d1.cevre()<<endl;
35
+}
0 commit comments