Mon-Sat 7:00-20:00 0161-3552854 +91 99 880 18243

Difference between C and CPP

Difference between C(POP) and C++(OOP)


The concept of object oriented is based on the fact that the real-world applications are easier to implement and understand if the classes and objects concepts are considered. The real-world situations like Banking, Employee, Library, Hotel, Reservation Systems are easier to build and modify using the object oriented concepts. OOP saves lots of coding and calling of the same code again and again. The inheritance and overloading concept are very useful to work with.

C Language was developed by Dennis Ritchie in 1972 at Bell Labs. C language was based on the idea that procedures(Functions) are better way to code and can separate the large single block code into small subparts and can be connected together in one place like main function. The data is not considered the important factor in Procedure Oriented Language and the data flows throughout the program freely. The security of data was not considered.

C++ Language developed by Bjarne Strawstroup at Bell Labs in 1975 primarily focused on the security of the data. C++ language considered data as an important entity and focuses on securing the access of it.

C Language(POP)

C++ Language(OOP)

1.It is procedure oriented language.

1.It is object oriented Language.

2. It does not have any way of securing the data so the data is not secure.

2.It provides Data Hiding with access specifiers like Private, Public and Protected.

3.It follows Top-Down Approach

3.It follows Bottom-Up Approach

4.Here data can move freely from one function to other function in the program.

4.Here data is considered as sensitive and is not allowed to move freely but objects can move freely.

5.Expansion of the program is difficult.

5.Expansion of the program is easy because of inheritance purpose.

6.Overloading is not possible either of operator or function.

6.Overloading is possible of operators as well as functions.

7.Programs are divided into functions.

7.Programs are divided into objects.

8.The main focus is on creating algorithm for the program.

8.The main focus is on data that is to be used in the program.

9.Example: C, Pascal, Fortran

9.Example: C++, Java, VB.NET, C#.NET

10.The different parts of the program are connected with each other through parameter passing.

10.The functions of the objects are linked with other objects by message passing.

11.Program in C Language



void main()


int a,b,c;

printf(“Enter the value of a and b”);



printf(“ Sum = %d”,c);



11.Program in C++ Language



void main()


int a,b,c;

cout<<”enter the values of a and b:”;



cout<<” Sum = “<



Example of Class and object:

Dogs as Class and Labrador, Pug, German Sheppard are the objects of the class.

class-and-object, c and cpp, concept of class

Note: All the objects share the features of class that is their variable and methods. They can also have their own properties that are different from other objects.

Class: it is a user defined data type in which member variables and member functions are placed together. It is an improvement over structures in c language. In structures, there are 2 main limitations:

  1. A structure cannot have member function defined inside. i.e

Struct record {

Void get()




}; Not Allowed

  1. A structure data members cannot be made secure from its objects. i.e.
    1. Struct Bank {

int accno;

float balance;

};Bank r1;

r1 is the object of structure and can access both members rno and marks. If we want to hide the balance variable, structures are not capable to do so.

In Class, both these limitations are removed that is:

  • Class can have functions as members.
  • Class can secure its member data from the object and child classes using access specifier’s like private, public and protected.

Class are the basis of all the concepts of OOPs.

Syntax of class:

class classname


private: member variables;

Member functions;

public: Member Variables;

Member Functions;


Example of Class:

class Bank


int accno;

float balance;

char accname[20];


void createacc()


cout<<”Enter accno , name and balance “;



void displayacc()


cout<” Bank AccountDetails : ”;

cout<<” Accno Name Balance ”;




Article by Naveen Coaching Classes