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. |
随机推荐
- 【转】随身HiFi 安卓OTG功能在音频上的妙用
原文网址:http://article.pchome.net/content-1745467.html 随身HiFi 安卓OTG功能在音频上的妙用 [PChome电脑之家音频频道原创]说起Androi ...
- 使用ant自动编译安卓项目并签名
准备阶段: 1.下载ant,jdk,android sdk ant下载地址:ant.apache.org/bindownload.cgi 2. 设置环境变量 ANT_HO ...
- HDU_2021——最少RMB问题
Problem Description 作为杭电的老师,最盼望的日子就是每月的8号了,因为这一天是发工资的日子,养家糊口就靠它了,呵呵但是对于学校财务处的工作人员来说,这一天则是很忙碌的一天,财务处的 ...
- Ubuntu 下配置Samba 实现Linux和windows之间文件共享
一 Samba 的安装: sudo apt-get insall sambasudo apt-get install smbfs 二 在Ubuntu中创建共享目录: mkdir /home/shar ...
- MyBatis第一个项目示例
1.创建一个Java project,JikeBook 2.添加项目所需的依赖包 如 mybatis-3.2.8.jar,是实现mybatis功能所必需的依赖包 mysql-connector-jav ...
- hdu 4585 Shaolin(STL map)
Problem Description Shaolin temple is very famous for its Kongfu monks.A lot of young men go to Shao ...
- angularJS怎么实现与服务端的PHP进行数据交互
//{params: 要传的参数obj },params这个是关键字不能换别的变量 $http.get(url, {params: {id: categoryid, key: keys} }).suc ...
- [原创作品]一个实用的js倒计时器 postby:zhutty.cnblogs.com
今天做了一个手机短信发送倒计时,额,就是每隔多长时间可以重新发送的功能.贡献出来给园有吐槽点评. //倒计时,time:时长(秒),scb:每秒回调,cb:计时完成回调 var timing = fu ...
- 我的创业劲儿,无可阻挡-JAVA学院张孝伟
导语:张孝伟,这个怀揣着创业梦想的农村小伙,为了报答父母的恩情,他开启了自己的逐梦之旅.友好的伙伴,火旺的生意.以前让他如鱼得水.就在他满足于现状的时候,一场突如其来的事故,让他一夜间倾家荡产.他是否 ...
- Linux下基于源代码方式安装MySQL 5.6
MySQL为开源数据库,因此能够基于源代码实现安装.基于源代码安装有很多其它的灵活性. 也就是说我们能够针对自己的硬件平台选用合适的编译器来优化编译后的二进制代码.依据不同的软件平台环境调整相关的编译 ...