DISHA NIRDESHAN

Enlightens your career

Tuesday, June 21, 2011

Difference among various concepts


 Major Differences Between C And C++

 

                                      C

                                    C++

C follows the procedural programming paradigm

C++ is a multi-paradigm language(procedural as well as object oriented)

 

In case of C, importance is given to the steps or procedure of the program

C++ focuses on the data rather than the process.
Also, it is easier to implement/edit the code in case of C++ for the same reason.

. In case of C, the data is not secured

the data is secured(hidden) in C+

C is a low-level language

C++ is a middle-level language

 

C uses the top-down approach

C++ uses the bottom-up approach

 

C is function-driven

&  Functions are the building blocks of a C program

C++ is object-driven & objects are building blocks of a C++ program.

 

 

We cannot   use function inside the structure

We can use function inside the structure 

 

C uses scanf & printf

C++ uses cin>> & cout<<

C doesnot allows reference varaibles

C++ allows the use of reference variables

 

 

 

 

Difference between a copy constructor and an assignment operator.  

 

Copy Constructor

Assignment Operator

                                                                                                                                                                             

Copy constructor creates a new object which has the copy of the original object. 

 

 

On the other hand assignment operators does not create any new object. It instead, deals with existing objects.

 

Difference between "C structure" and "C++  Structure".


                 or

Define classes and structure.

 

 

                            Class

                      Structure

User defined data type which contains data and methods to manipulate that data; is known as class.

A structure is a collection of variables, referenced under one name, providing a convenient means of keeping related information together.

Each object is associated with the data of type class with which it is created.

Structure declaration forms a template which can be used to create structure objects.

An object is a variable of a Class.

variables inside a structure are called members.

Class declaration precedes the keyword Class.

 

Structure declaration precedes the keyword struct.

 

Eg.
class Student
{
           int rollno;
           int marks1, marks2;
           public:
                      void show(int r); // to print marks
                      void sum(int r); // to add the marks
};

 

example:

struct address
{
            char name[80];
            char street[80];
            char city[20];
            char state[20];
};

 

 


0 comments :