Question:
Difference between "C structure" and "C++ structure".
Answer:
They are different. C struct can only contain data while C++ struct can contain functions and access limitation such as public, private etc just as a class (not totally the same as class!) Source: CoolInterview.com
C structure::: 1)//single line comment about the programme. 2)headerfiles 3)macros,typedef... 4)global declarations 5)main() 6)statements.......
C++ STRUCTURE:::
1)/*multi line comments*/ 2)headerfiles 3)typedef,inline functions 4)global variables. 5)class starts 6)acces specifiers 7)statements..... 8)class ends with an ; 9)main starts 10)statements. 11)main ends Source: CoolInterview.com
Answered by: kishore reddy | Date: 1/15/2008
| Contact kishore reddy
C-structure is based on collection of various data types in a single unit. It is open to all. while C++ structure is " class " which contains all functions of c and additional features as data binding and data hiding. Source: CoolInterview.com
Answered by: darshanjeet | Date: 1/15/2008
| Contact darshanjeet
In "c" a structure binds different types of data under a same name. like if we have to work with an employee's name of type char,his age of type int, his sex of type char or his address of type char then we can declare a structure named as employee so that we can use all its variable in the function. with this ease "c" doesn't provide any security on using structure and any function can use its data. the second limitation is that the structure in "c" allow only data or variable in it..there is no space for function.
These limitations are overcomed in "c++" structure whose name is "class". the class gives us a facility to bind data and function which can use these data together in a new data type. it covers the real world objects like school, car.......and many mores. this also provides security on the data by its data hiding facility......... It gives thee visibility label to us_public,protected and private,so tht we can block unwanted access of data.
Source: CoolInterview.com
Answered by: Ruchi jha | Date: 7/31/2010
| Contact Ruchi jha
c is a middle level language while c++ is high level language. In C there is co concept of inheritance while in c++ it is available. And C++ is near to real world. Source: CoolInterview.com
Answered by: aashi soni | Date: 8/26/2010
| Contact aashi soni
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|