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. |
随机推荐
- 【转】C++读写二进制文件
原文网址:http://blog.csdn.net/lightlater/article/details/6364931 摘要: 使用C++读写二进制文件,在开发中操作的比较频繁,今天有幸找到一篇文章 ...
- N次剩余
$$求解x^n\equiv a(\%P),其中P是质数,0\leq x<P$$ 设$g$是$P$的原根 那么$g^0,g^1,...,g^{P-2}$和$1,2,...,P-1$是一一对应的. ...
- 型牌男装施春蕾:分拆让马云对淘宝定位更清晰--互联网 -- CCTIME飞象网
型牌男装施春蕾:分拆让马云对淘宝定位更清晰--互联网 -- CCTIME飞象网 型牌男装施春蕾:分拆让马云对淘宝定位更清晰 2011年6月17日 13:16 CCTIME飞象网 ...
- cavium octeon 处理器启动总线Bootbus 简介
cavium octeon 处理器启动总线Bootbus 简介: 韩大卫@吉林师范大学 Boot-bus(启动总线)是cavium octeon处理器的一种用于启动系统的硬件. CPU通过boot b ...
- 最长回文字符串(manacher算法)
偶然看见了人家的博客发现这么一个问题,研究了一下午, 才发现其中的奥妙.Stupid. 题目描述: 回文串就是一个正读和反读都一样的字符串,比如“level”或者“noon”等等就是回文串. ...
- mysql中DES加密解密
DES_DECRYPT(crypt_str[,key_str]) 使用DES_ENCRYPT()加密一个字符串.若出现错误,这个函数会返回 NULL. 注意,这个函数只有当MySQL在SSL 的支 ...
- java设计模式---原型模式
原型模式(Prototype):用原型实例指定创建对象的种类,并且通过拷贝这些原型创建新的对象. 原型模式结构图 通俗来说:原型模式就是深拷贝和浅拷贝的实现. 浅拷贝 只实现了值拷贝,对于引用对象还是 ...
- linux查看系统版本
RHEL7.0以下,查看系统版本的方式: [rusky@rheltest1 ~]$ cat /proc/version Linux version -.el6.x86_64 (mockbuild ...
- Python-字符串开头或结尾匹配
startswith() 和 endswith() 方法提供了一个非常方便的方式去做字符串开头和结尾的检查. 1.查看指定目录下的所有文件名 >>> import os >&g ...
- linux 下文件的比较
1.cmp命令,比较两个文件是否相同 比较文件test1和test2,如果这两个文件完全相同,则无任何输出,否则,输出第一处不同所在的字节以及行号,然后忽略后面的不同之处,退出命令的执行. [root ...