How size of a class can be calulated?
Answers were Sorted based on User's Feedback
Answer / spoorthi.hebbar
THE SIZE OF THE ATTRIBUTES OF CLASS IS THE ANSWER..
EG.
CLASS DEMO
{
INT A; //IT IS 4 BYTES LONG
INT B; //IT IS 4 BYTES LONG
}
THE TOTAL SIZE IS 8 BYTES.
| Is This Answer Correct ? | 8 Yes | 2 No |
Answer / shweta iyer
Size of a class can be calculated by adding up the size of all its data members.
For example:
class student
{
char name[20]; -----> 4*20=80
int rollno[5]; -----> 2*5=10
......
}
So size of class student is 80+10=90.
| Is This Answer Correct ? | 0 Yes | 0 No |
How do you initialize a class member, class x { const int i; };
Difference between declaration and definition of a variable.
Can circle be called an ellipse?
What are advantages of C++ when comparing with C?
18 Answers HP, iGate, TCS,
What do you mean by delegate? Can a user retain delegates?
What is the latest c++ standard?
Why is c++ is better than c?
What is the difference between a baller and a reference in C++?
what is the emaning of '#include" "'?
when can we use copy constructor?
string somestring ; Which of the following choices will convert a standard C++ string object "somestring" to a C string? a) Copy.somestring () ; b) somestring.c_str () c) &somestring [1] d) std::cstring (somestring) e) (char *) somestring
Is it possible to provide default values while overloading a binary operator?