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 |
What are static and dynamic type checking?
Can the operator == be overloaded for comparing two arrays consisting of characters by using string comparison?
Where do I find the current c or c++ standard documents?
What is a base class?
What is the output of: String a1 = "Hello"; String a2 = "world!"; String* s1 = &a2; String& s2 = a1; s1 = &a1; s2 = a2; std::cout << *s1 << " " << s2 << std::endl;
What is the output of the following program? Why?
What is rtti in c++?
Differentiate between the message and method in c++?
Is c++ vector a linked list?
How can we check whether the contents of two structure variables are same or not?
What will the line of code below print out and why?
write a programming using for loop in c++ to generate diamond trangel?