How size of a class can be calulated?

Answers were Sorted based on User's Feedback



How size of a class can be calulated?..

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

How size of a class can be calulated?..

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

Post New Answer

More C++ General Interview Questions

Can a built-in function be recursive?

0 Answers  


Do you know about C++ 11 standard?

0 Answers   Agilent, ZS Associates,


In a function declaration what does extern means?

0 Answers   Flextronics,


What is flush programming?

0 Answers  


Is c# written in c++?

0 Answers  






Can we remove an element in a single linked list without traversing? Lets suppose the link list is like this 1 2 3 4 5 6 We need to remove 4 from this list (without traversing from beginning) and the final link list shud be 1 2 3 5 6 only thing we know is the pointer to element "4". How can we remove "4" and link "3" to "5"?

6 Answers   CSC,


What is the difference between public and private data members?

0 Answers  


What is an arraylist c++?

0 Answers  


What is a storage class? Mention the storage classes in c++.

0 Answers  


What is an inline function in c++?

0 Answers  


What is data structure in c++?

0 Answers  


What is the best it certification?

0 Answers  


Categories