Code Question

This is a discussion on Code Question within the C++ Programming forums, part of the General Programming Boards category; What is ther difference between these two functions Code: List::List(): head_(0) {} AND List::List() { head_=0 ; } //are they ...

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    84

    Code Question

    What is ther difference between these two functions
    Code:
    List::List():  head_(0)
    {}
    
    AND
    
    List::List()  
    {
    head_=0 ;
    }
    
    //are they both doing the same thing if so what is the : doing?

  2. #2
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  3. #3
    Registered User
    Join Date
    Aug 2001
    Posts
    84

    Whats up

    Nobody can answere this question!!!!!!!!!!!!!!!!!!!!!!!!!!!

  4. #4
    1479
    Join Date
    Aug 2003
    Posts
    253
    They are called initializers......read up on them.
    Knowledge is power and I want it all

    -0RealityFusion0-

  5. #5
    Grammar Police HybridM's Avatar
    Join Date
    Jan 2003
    Posts
    355
    It's funny I didn't see these at all in my C++ book, then again it is Herb Shildt. (don't panic I'm buying some more soon).

    Drew, JaWiB answered your question very well....did you even click the link?!
    Thor's self help tip:
    Maybe a neighbor is tossing leaf clippings on your lawn, looking at your woman, or harboring desires regarding your longboat. You enslave his children, set his house on fire. He shall not bother you again.

    OS: Windows XP
    Compiler: MSVC

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Hi all i have a question about a code
    By iweapons in forum C++ Programming
    Replies: 5
    Last Post: 05-23-2007, 12:05 PM
  2. I need help to compile this code...
    By wise_ron in forum C Programming
    Replies: 17
    Last Post: 05-07-2006, 01:22 PM
  3. My First If Code, Question? :P
    By dimirpaw in forum C++ Programming
    Replies: 3
    Last Post: 11-29-2005, 08:49 PM
  4. End of Code Loop Question
    By JuanSverige in forum C++ Programming
    Replies: 1
    Last Post: 04-08-2003, 11:35 AM
  5. question about my code
    By killerasp in forum C++ Programming
    Replies: 7
    Last Post: 02-18-2002, 08:05 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21