面向对象程序设计

C++ 完全支持面向对象的程序设计,包括面向对象开发的四大特性:

封装
抽象
继承
多态

 

 1 #include <iostream>
 2 
 3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */
 4 using namespace std;
 5 int main(int argc, char** argv) {
 6     int a,b,sum;
 7     cin >>a >>b;
 8     sum=a+b;
 9     cout <<"a+b="<<sum<<endl;
10     return 0;
11 }

 

posted @ 2018-08-01 13:28  borter  阅读(91)  评论(0编辑  收藏  举报