Need help in c++.
I have completed C last year and now starting studing C++. Can anyone help me please..😕
Member • Aug 5, 2010
Member • Aug 5, 2010
Member • Aug 6, 2010
Member • Aug 6, 2010
Member • Aug 6, 2010
Member • Aug 6, 2010
Member • Aug 6, 2010
Member • Aug 6, 2010
Member • Aug 7, 2010
#include<iostream.h>Here in the above program the struct is defined outside the main().And one thing to notice is that there is no struct variable declared but it shows the size of the struct node.It proves that it is a physical concept since without declaring the structure variable it take memory space.But that is not in the case of class is totally logical unless we create an object it is no going to take any memory space.
struct node
{
int a;
};
void main()
{
cout<<"output="<<sizeof (struct node);
}
#include<iostream.h>
#include<conio.h>
class A
{
public:
int a;
};
void main()
{
A a;/*here object is created and this allows to take the memory space for the class variable.
unless you create object class has no existence*/
cout<<"Size of A="<<sizeof (a);
getch();
}
Member • Aug 7, 2010
Member • May 17, 2011