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. |
随机推荐
- IIS 403.14 - Forbidden错误解决方法
HTTP 错误 403.14 - ForbiddenWeb 服务器被配置为不列出此目录的内容. 解决方法如下: 打开IIS的”处理程序映射设置“,在右边的操作栏下有 ”添加脚本映射“请求路径:*可执行 ...
- HDU_1174——爆头,空间直线方程,直线到点的距离
Problem Description gameboy是一个CS高手,他最喜欢的就是扮演警察,手持M4爆土匪的头.也许这里有人没玩过CS,有必要介绍一下“爆头”这个术语:所谓爆头,就是子弹直接命中对方 ...
- [LeetCode] 61. Rotate List 解题思路
Given a list, rotate the list to the right by k places, where k is non-negative. For example:Given 1 ...
- GF(2^8)乘法优化
利用指数表和对数表,实现GF(2^8)的乘法优化. 首先利用简单的基础的GF(2^8)乘法,构造指数表和对数表.在这里选取生成元3. 指数表exp[i] = 3^i,对数表log[i] = log3( ...
- Java实现生命周期管理机制
先扯再说 最近一直在研究某个国产开源的MySQL数据库中间件,拉下其最新版的代码到eclipse后,启动起来,然后做各种测试和代码追踪:用完想要关闭它时,拉出它的STOP类想要运行时,发现这个类里赫然 ...
- Java[1] Java学习书籍汇总(转)
原文:http://www.cnblogs.com/hyl8218/p/5067000.html 学习的最好途径就是看书“,这是我自己学习并且小有了一定的积累之后的第一体会.个人认为看书有两点好处: ...
- Intellj Idea 2016.1.3的使用
Intellj Idea 2016.1.3的使用:http://blog.csdn.net/bleachswh/article/details/51811055 极客学院教程:http://wiki. ...
- angularJS怎么实现与服务端的PHP进行数据交互
//{params: 要传的参数obj },params这个是关键字不能换别的变量 $http.get(url, {params: {id: categoryid, key: keys} }).suc ...
- Dynamics CRM记录页面上隐藏子网格“+”标识
前段时间微软发布了Dynamics 365,这是Dynamics产品的又一次大的变动,期待新的版本能够更好的满足客户的需求,同时提供更多的可定制化的内容. 近期做Dynamics CRM项目遇到很多审 ...
- mevan引入容联云通讯jar
首先从官网下载jar 然后拷贝到lib目录下 最后在pom.xml中这样写 <dependency> <groupId>cn.com</groupId> <a ...