Results 1 to 2 of 2

Thread: Classes again....

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2000
    Posts
    47

    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...

  2. #2
    Frenzied Member Vlatko's Avatar
    Join Date
    Aug 2000
    Location
    Skopje, Macedonia
    Posts
    1,409
    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.
    I am become death, the destroyer of worlds.
    mail:[email protected]

    • Visual Basic 6.0 & .NET
    • Visual C++ 6.0 & .NET
    • ASP
    • LISP
    • PROLOG
    • C
    • Pascal

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width