Thread: syntax question

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    494

    syntax question

    is there any similiarities between
    Code:
    std::cout
    and
    Code:
    int Car::GetYear()
    since Car is a class, is std a predefined class too?

    another question.

    if Car is a class and GetYear is a accessor function why do we use the :: ?
    When no one helps you out. Call google();

  2. #2
    Registered User
    Join Date
    Jan 2003
    Posts
    648
    std is a namespace. They're like libraries or packages in java. Its a group of classes, data, functions, and definitions.

    The :: is the scope resolution operator. You need to use it to tell the compiler that the thing on the right belongs in the thing on the left.

  3. #3
    Registered User
    Join Date
    Mar 2004
    Posts
    494
    ah cool
    When no one helps you out. Call google();

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Syntax question: &(++x)
    By yoshiznit123 in forum C Programming
    Replies: 8
    Last Post: 06-02-2006, 10:40 PM
  2. using c++ in c code
    By hannibar in forum C Programming
    Replies: 17
    Last Post: 10-28-2005, 09:09 PM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 08:57 AM
  5. pointer to array of objects of struct
    By undisputed007 in forum C++ Programming
    Replies: 12
    Last Post: 03-02-2004, 04:49 AM