Say I have a class (say number) and declare a private variable (say int num) and have a public member function(say int getnum() ) that retrieves the private variable. When I in the main() without initializing the private variable int num (of course after declaring the class variable say test) call cout<<test.getnum() it gives me a very random number -for me negative 858993350. what is this number? Is it whatever was stored there before it was allocated as an int? thx
CPPRULZ 0 Junior Poster in Training
VernonDozier 2,218 Posting Expert Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.