//Skip to content
Data abstraction in c++
- #include<bits/stdc++.h>
- using namespace std;
-
- class Shape{
- public:
- virtual void show()=0;
- };
-
- class Circle:public Shape{
- public:
- void show(){
- cout<<"Circle"<<endl;
- }
- };
-
- class Rectangle:public Shape{
- public:
- void show(){
- cout<<"Rectangle"<<endl;
- }
- };
-
- int main()
- {
- Shape *shape;
- Circle circle;
- Rectangle rectangle;
-
- shape=&circle;
- shape->show();
-
- shape=&rectangle;
- shape->show();
-
- return 0;
- }
I am Md Abdullah Al Hasan. I have completed my graduation in Computer Science and Engineering from Jashore University of Science and Technology.
0 Comments:
Post a Comment