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 pointers work?
Can you be bale to identify between straight- through and cross- over cable wiring? And in what case do you use straight- through and cross-over?
How to stop conversions among objects?
What does override mean in c++?
How can we read/write Structures from/to data files?
To what does “event-driven” refer?
When is the copy constructor called?
What are the differences between a struct and a class in C++?
Difference between a copy constructor and an assignment operator.
Can we distribute function templates and class templates in object libraries?
How do you flush a buffer in c++?
Does c++ have string data type?