转自: 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

  • scanf() Function used for Input.
  • printf() Function used for output.
8. In C++

  • Cin>> Function used for Input.
  • Cout<< Function used for output.
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.

随机推荐

  1. uniq 命令

    uniq 命令 文字 uniq是LINUX命令 用途 报告或删除文件中重复的行. 语法 uniq [ -c | -d | -u ] [ -f Fields ] [ -s Characters ] [ ...

  2. HDU_2058——等差数列,子集,集合长度判断

    Problem Description Given a sequence 1,2,3,......N, your job is to calculate all the possible sub-se ...

  3. memcached学习——分布式算法(Consistant hash + 虚拟节点)(三)

    1.取余算法 优点:数据分布均匀缺点:当服务器动态的添加.删除节点或者某台server down掉,会导致命中率超大幅度下降,甚至导致服务不可用 2.Consistant Hash算法:一致性哈希算法 ...

  4. iOS单元测试(作用及入门提升)

    由于只是一些简单实用的东西,学学还是挺不错的.其实单元测试用的好,开发起来也会快很多.单元测试对于我目前来说,就是为了方便测试一些功能是否正常运行,还有调试接口是否能正常使用.有时候你可能是为了测试某 ...

  5. Eclipse设置保存时自动给变量加final

    也是针对checkstyle的,在代码检查规范时,所有的变量必须是final.为了解决这个问题,通过以下的设置可以在eclipse保存时,自动给没有加final的变量加上final. Window-& ...

  6. [教程] 神器i9100刷基带与内核的方法!(兼带ROOT方法)

    http://bbs.hiapk.com/thread-2647905-1-1.html ------何为基带?何为内核? 为什么刷基带,为什么刷内核?!!! 基带:基带(Baseband)是手机中的 ...

  7. 面向对象CSS (OOCSS)

    新版 OOCSS 请关注 http://www.oocss.cc/ 时下流行面向对象,那么有没有可能把样式表也面向对象一下呢,将现在的CSS(Cascading Style Sheets层叠样式表)进 ...

  8. 用SHELL与列表处理了件尴尬事

    与列表语法 command-1 && command-2 && command-3 && command-4 && ...command ...

  9. 内容提供者 ContentResolver 数据库 示例 -1

    MainActivity public class MainActivity extends ListActivity {     private TextView tv_info;     priv ...

  10. Java线程同步与死锁认识

    讲下自己的认识,算小小的总结吧! synchroized 具有同步线程的功能,它的处理机制类似于给参数里面的对象赋一个标记值,来表明当前状态,当程序里面某个线程执行synchroized里面的代码段时 ...