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
Lists the benefits of c programming language?
an expression contains relational operators, assignment operators, and arithmatic operstors. In the absence of parentheses, they will be evaluated in which of the following order a) assignment, relational, arithematic b) arithematic, relational, assignment c) relational, arithematic, assignment d) assignment, arithematic, relational
Explain the use of fflush() function?
#define MAX(x,y) (x) >(y)?(x):(y) main() { inti=10,j=5,k=0; k= MAX(i++,++j); printf("%d..%d..%d",i,j,k); }
Difference between exit() and _exit() function?
Explain function?
main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }
Explain how do you print only part of a string?
In the DOS enveronment, normal RAM that resides beyond the 1mb mark. a) expanded memory b) swapped memory c) Extended memory d) none
What is typedef example?
What is the use of a conditional inclusion statement in C?
What tq means in chat?
What is a lookup table in c?
Can the “if” function be used in comparing strings?
When should the volatile modifier be used?