According to Herbert schildt C++ complete reference "A non-static member variable cannot have an initializer."
however when i run following code,it runs..

class ABC
{

public:
int a=3; 
ABC();


};

ABC::ABC()
{cout<<a;
}
int main()
{
ABC obj;
}

regards,

It largely depends on your compiler and switches. C++11 (the latest standard) added this feature, and some compilers prior to that offered it as an extension.

Your book is old, by the way, and also written by an author who's routinely mocked for making grievous beginner mistakes. You might consider getting a different one.