Skip to content

Commit 63d99ef

Browse files
committed
Create main.cpp
1 parent dca4e48 commit 63d99ef

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

cpp/OOP/encapsullation/main.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)