Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Difference between structure in C and class in C++

1) In structure all members are by default public. In class all members are by default
private.
2) Structure cannot be inherited. But class can be inherited.
3) There is no data hiding features comes with structures. Classes do, private, protected
and public.
4) A structure is contain only data members , but class contain data member and member
function both.

Difference between C and C++

In case of C, importance is given to the functions/procedure of the program while C+


+ focuses on the data rather than the procedure.
In case of C, Data moves freely around the system i.e the data is not secured while
the data is secured(hidden) in C++
C uses the top-down approach while C++ uses the bottom-up approach
We can use functions inside structures in C++ but not in C
Data and functions cannot be easily added in c, but in c++ data and functions can be
easily added when necessary.

You might also like