Skip to content

Commit 4b37691

Browse files
author
Sumit tripathi
committed
another example base on abstraction
1 parent 147102c commit 4b37691

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

Abstraction.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/*
12
#include <iostream>
23
using namespace std;
34
@@ -45,4 +46,33 @@ int main()
4546
obj.color();
4647
obj.cost();
4748
obj.oil();
49+
}
50+
51+
52+
53+
*/
54+
55+
56+
57+
58+
#include<iostream>
59+
using namespace std;
60+
class Base{
61+
private :
62+
int a, b;
63+
public:
64+
void setData(int x, int y){
65+
a = x;
66+
b = y;
67+
}
68+
void display(){
69+
cout << "The value of a is: " << a << endl;
70+
cout << "The value of b is: " << b << endl;
71+
}
72+
};
73+
int main(){
74+
Base ob;
75+
ob.setData(7, 5);
76+
ob.display();
77+
return 0;
4878
}

Abstraction.exe

-32 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)