Thread: C++ Noob Class Confusion

  1. #16
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by Freestyler View Post
    Why do you believe my "QString File;" is not having any global affect? And what is the standard method to share the "File" data in this case between classes?
    Because I can read. You explicitly state, by saying "QString File;" that you discard all possibility of using the global variable of the same name. It no longer exists for you to use.

  2. #17
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by Freestyler View Post
    Why do you believe my "QString File;" is not having any global affect? And what is the standard method to share the "File" data in this case between classes?

    I feel this seems to be too much of a pain to be the correct way.
    What you create is a local variable. It is unique to the local method only. It will be discarded when the method dies.
    I am also somewhat distrusting as why you need to share this ... data between your classes?
    The idea is that a class is a unique instance of something--an object. Just as you can have a thousand cars from the same blueprint.

    Quote Originally Posted by tabstop View Post
    Because I can read. You explicitly state, by saying "QString File;" that you discard all possibility of using the global variable of the same name. It no longer exists for you to use.
    That's not entirely true.
    The global File can still be accessed via ::File.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Creating a database
    By Shamino in forum Game Programming
    Replies: 19
    Last Post: 06-10-2007, 01:09 PM
  3. deriving classes
    By l2u in forum C++ Programming
    Replies: 12
    Last Post: 01-15-2007, 05:01 PM
  4. Need help to build network class
    By weeb0 in forum C++ Programming
    Replies: 0
    Last Post: 02-01-2006, 11:33 AM