|
-
Jul 9th, 2001, 11:44 AM
#1
Thread Starter
Member
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...
-
Jul 9th, 2001, 12:02 PM
#2
Frenzied Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|