Difference between Class and Struct.
Answer Posted / naresh kukreti
The struct default access type is public. A struct should
typically be used for grouping data.
The class default access type is private, and the default
mode for inheritance is private. A class should be used for
grouping data and methods that operate on that data.
In short, the convention is to use struct when the purpose
is to group data, and use classes when we require data
abstraction and, perhaps inheritance.
In C++ structures and classes are passed by value, unless
explicitly de-referenced. In other languages classes and
structures may have distinct semantics - ie. objects
(instances of classes) may be passed by reference and
structures may be passed by value.
| Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
a) Identify the following declarations. Ex. int i (integer variable) float a[l0](array of 10 real nos) int (*f())() void *f int (*f()) [] void *f int f[] [] [] char *(*f) () int (*f[]) [] float(*f) [] [] float **f int ******f
how could explain about job profile
What is a pointer on a pointer in c programming language?
How would you rename a function in C?
why use "return" statement a) on executing the return statement it immediately transfers the control back to the calling program b) it returns the value present in the parentheses return, to the calling program c) a & b d) none of the above
What is the use of getchar() function?
What functions are used for dynamic memory allocation in c language?
Which are low level languages?
Explain what are global variables and explain how do you declare them?
Explain Function Pointer?
What is sizeof c?
Does sprintf put null character?
What is variable initialization and why is it important?
What are the features of c languages?
write a C program:There is a mobile keypad with numbers 0-9 and alphabets on it. Take input 0f 7 keys and then form a word from the alphabets present on the keys.