C 和 C++的 不同
转自: http://studytipsandtricks.blogspot.com/2012/05/15-most-important-differences-between-c.html
Basic Introduce:
- C++ is derived from C Language. It is a Superset of C.
- Earlier C++ was known as C with classes.
- In C++, the major change was the addition of classes and a mechanism for inheriting class objects into other classes.
- Most C Programs can be compiled in C++ compiler.
- C++ expressions are the same as C expressions.
- All C operators are valid in C++.
Following are the differences Between C and C++ :
| C | C++ |
| 1. C is Procedural Language. | 1. C++ is non Procedural i.e Object oriented Language. |
| 2. No virtual Functions are present in C | 2. The concept of virtual Functions are used in C++. |
| 3. In C, Polymorphism is not possible. | 3. The concept of polymorphism is used in C++. Polymorphism is the most Important Feature of OOPS. |
| 4. Operator overloading is not possible in C. | 4. Operator overloading is one of the greatest Feature of C++. |
| 5. Top down approach is used in Program Design. | 5. Bottom up approach adopted in Program Design. |
| 6. No namespace Feature is present in C Language. | 6. Namespace Feature is present in C++ for avoiding Name collision. |
| 7. Multiple Declaration of global variables are allowed. | 7. Multiple Declaration of global varioables are not allowed. |
8. In C
|
8. In C++
|
| 9. Mapping between Data and Function is difficult and complicated. | 9. Mapping between Data and Function can be used using "Objects" |
| 10. In C, we can call main() Function through other Functions | 10. In C++, we cannot call main() Function through other functions. |
| 11. C requires all the variables to be defined at the starting of a scope. | 11. C++ allows the declaration of variable anywhere in the scope i.e at time of its First use. |
| 12. No inheritance is possible in C. | 12. Inheritance is possible in C++ |
| 13. In C, malloc() and calloc() Functions are used for Memory Allocation and free() function for memory Deallocating. | 13.In C++, new and delete operators are used for Memory Allocating and Deallocating. |
| 14. It supports built-in and primitive data types. | 14. It support both built-in and user define data types. |
| 15. In C, Exception Handling is not present. | 15. In C++, Exception Handling is done with Try and Catch block. |
随机推荐
- 【转】Java多线程操作局部变量与全局变量
原文网址:http://blog.csdn.net/undoner/article/details/12849661 在这篇文章里,我们首先阐述什么是同步,不同步有什么问题,然后讨论可以采取哪些措施控 ...
- P2P网贷投资须谨防圈钱人
摘要:P2P领域依然呈现投资热潮,甚至部分国有大行也有意涉足.这个行业到底怎么了?P2P平台上高收益的理财产品,到底能买不? 新年才刚刚过了10天,就有4家网贷平台被爆出支付危机,P2P一时被 ...
- 解耦——Hybrid H5跨平台性思考
跨平台,是HTML5最重要的能力之一.而Hybrid H5因强依赖于具体App,往往不具有跨平台性.这时,将强依赖关系解耦,即可恢复HTML5的跨平台能力.近期我负责手Q红包打赏项目的前端开发,因项目 ...
- OpenRisc-44-or1200的pipeline整体分析
引言 我们在前面分析了ORPSoC,or1200_top,和or1200_cpu的整体架构,在最近,我们也分析了or1200的pipeline(流水线)中的两级,EX级和IF级. 但是,我们还没有从宏 ...
- MYSQL存储过程和函数学习笔记
学至Tarena金牌讲师,金色晨曦科技公司技术总监沙利穆课程笔记的综合. 1. 什么是存储过程和函数 将SQL语句放入一个集合里,然后直接调用存储过程和函数来执行已经定义好的SQL语句,通过存储过程和 ...
- Highcharts 时间序列,可缩放的图表
配置 图表 配置可缩放图表. chart.zoomType 指定了用户可以拖放的尺寸,用户可以通过拖动鼠标来放大,可能值是x,y或xy: var chart = { zoomType: 'x' }; ...
- iOS个别界面旋转问题
/*是否应该自动旋转屏幕**/ - (BOOL)shouldAutorotate{ return YES; } /*是否支持屏幕旋转并指明旋转方向**/ - (UIInterfaceOrientati ...
- 关于IE8导航串行的问题
1.概述: 作为一个前端人员,多浏览器兼容是必须必备的技能,现在一般要求是兼容IE8及以上,如果兼容IE6的话,会麻烦一些,这里介绍的是在IE8状态下我们导航条错位的问题. 2.导航错位代码 < ...
- [Angular 2] Filter items with a custom search Pipe in Angular 2
This lessons implements the Search Pipe with a new SearchBox component so you can search through eac ...
- 标准爬虫初探,来自Python之父的大餐!
首先不得不承认自己做了标题党.本文实质是分析500lines or less的crawlproject,这个project的地址是https://github.com/aosabook/500line ...