include / import

Discussion in 'C++' started by worlman385@yahoo.com, Mar 13, 2008.

  1. Guest

    Is that when ever I want to call any function or use any Class ojbect
    / structure, I will include that .h header file that contain that
    Class object?

    include <winsock.h>;

    It's basically same as Java where I important the Class whenever I
    want to use that Class -

    import java.lang.String;
    , Mar 13, 2008
    #1
    1. Advertising

  2. Rolf Magnus Guest

    wrote:

    > Is that when ever I want to call any function or use any Class ojbect
    > / structure, I will include that .h header file that contain that
    > Class object?


    Usually, yes.

    > include <winsock.h>;


    Remove that semicolon at the end and add a # at the start.

    > It's basically same as Java where I important the Class whenever I
    > want to use that Class -
    >
    > import java.lang.String;


    Not exactly. The preprocessor will just replace an #include directive with
    the code that is contained in the header file. So the following compiler
    steps just see the whole thing as if you had copied the header's text into
    your source file.
    Rolf Magnus, Mar 13, 2008
    #2
    1. Advertising

  3. wrote:
    > Is that when ever I want to call any function or use any Class ojbect
    > / structure, I will include that .h header file that contain that
    > Class object?
    >
    > include <winsock.h>;


    It's not mandatory, but it's the easiest way. (The alternative is more
    complicated.)
    Juha Nieminen, Mar 13, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Danny Anderson
    Replies:
    5
    Views:
    486
    Victor Bazarov
    Aug 15, 2003
  2. Rolf Magnus
    Replies:
    2
    Views:
    590
    Karl Heinz Buchegger
    Nov 28, 2003
  3. Elie Nader
    Replies:
    1
    Views:
    626
  4. Aguilar, James
    Replies:
    2
    Views:
    676
    Aguilar, James
    Jul 16, 2004
  5. Andreas Bogenberger
    Replies:
    3
    Views:
    888
    Andreas Bogenberger
    Feb 22, 2008
Loading...

Share This Page