Dear all,
I was just having fun by writing a simple class in C++ today and i found out this
[code=cpp]
#include<iostre am.h>
class A
{
public :
int a;
}
main()
{
A b;
b.a = 5;
cout<<"The value of a is:"<<b.a;
}[/code]
this code works absolutely fine even though the class is not closed with a semicolon ";" and if i replace in the above code the main function by VOID MAIN() then it doesn't work!!!!
Is there any defined reason for this thing happening?????
Thanks in advance.
Regards
Nrip
I was just having fun by writing a simple class in C++ today and i found out this
[code=cpp]
#include<iostre am.h>
class A
{
public :
int a;
}
main()
{
A b;
b.a = 5;
cout<<"The value of a is:"<<b.a;
}[/code]
this code works absolutely fine even though the class is not closed with a semicolon ";" and if i replace in the above code the main function by VOID MAIN() then it doesn't work!!!!
Is there any defined reason for this thing happening?????
Thanks in advance.
Regards
Nrip
Comment