what is the size of a class which contains no member
variables but has two objects??? is it 1 or 2??
Answer Posted / vasanth
class a
{
};
void main()
{
a obj1;
a obj2;
cout<<"sizeof class = "<<sizeof(a)<<endl<<"sixeof
obj1 = "<<sizeof(obj1)<<endl<<"sixeof obj2 = "<<sizeof(obj2)
<<endl;
}
--------------------
always sizeof the empty class is 1 byte and each object it
will tak 1 byte.
Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
Is map thread safe c++?
What is problem with overriding functions?
Will rust take over c++?
What is the use of map in c++?
Specify different types of decision control statements?
How do you save a c++ program?
Define a constructor?
Do you know what is overriding?
Describe the syntax of single inheritance in C++?
Explain virtual destructor?
How static variables and local variablesare similar and dissimilar?
A company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9 percent of their gross sales for that week. For example, a saleperson who sells $5000 worth of merchandise in a week receives $200 plus 9 percent of $5000, or a total of $650. You have been supplied with a list of items sold by each salesperson. The values of these items are as follows: Item Value A 239.99 B 129.75 C 99.95 D 350.89 Write a program that inputs one salesperson's items sold in a week (how many of item A? of item B? etc.) and calculates and displays that salesperson's earnings for that week.
Can you explicitly call a destructor on a local variable?
Define pre-condition and post-condition to a member function in c++?
What is the difference between a definition and a declaration?