Thinking in c++ has this question :
Create a class containing an int, a constructor that intializes the int from it's argument , and a print() function to display the int. Now create a second class that contains a static object of the first one. Add a static member function that calls the static object's print() function .exercise your class in main().
I have written the following code undefined refernce to withStatic :: WS. Someone please tell me what's wrong?
You never initialized WS. You have to initalize static variables outside the class add this after the withStatic class: withoutStatic withStatic::WS(somevalue);