-
Classes again....
Hi,
I have some more questions about classes.
1. How do you insert values (using cin>>) to a class variable, do you put it in methods, or in main function?
2. How do you call a constructor and what kind of data will it return.
I also have a question which doen not belong here, it's about cd-roms. Since you people know alot, I hope someone will help me.
Ok, here's the problem.
One of my cd-rom tries to run a cd, and after a 30 sec try, it re-opens.
Another of my cd-roms was all fine untill I tried to reinstall my windows. From now on, it doesn't read any cds. What may be the problem?
Thank Yo For Your Help...
-
1. Inserting values into a class variable should be done using accesor functions and not direcyly to a public var. The vars should be private and member functions should be used to alter them. In the main function use cin to put a value into a local variable. Then use a class member function to assign the value to the class variable.
2. Constructors and destructors do not return data directly. They are automatically caleed when an object is created.