void func1(arg1...)const -- question

This is a discussion on void func1(arg1...)const -- question within the C++ Programming forums, part of the General Programming Boards category; hi...i'm new with c++ and I was wondering what does that const do, I've seen it in a lot of ...

  1. #1
    Registered User
    Join Date
    Jul 2006
    Posts
    2

    Question void func1(arg1...)const -- question

    hi...i'm new with c++ and I was wondering what does that const do, I've seen it in a lot of examples in a c++ book I'm reading but don't know, or find it in the book, if the writter mentioned that...so please help me understand...

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,340
    Its used for member functions. It indicates that the function will not change the state of the object it is working on. For example, if you have a getName() function that returns a name, it doesn't actually change anything with the class, so you would make it const.

  3. #3
    Registered User
    Join Date
    Jul 2006
    Posts
    2

    Talking

    thanks a lot daved...now it makes a little more sense...and it shades a little light on some erros that I got....

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Inserting a swf file in a windows application
    By face_master in forum Windows Programming
    Replies: 12
    Last Post: 05-03-2009, 11:29 AM
  2. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 02:07 AM
  3. Polynomials and ADT's
    By Emeighty in forum C++ Programming
    Replies: 20
    Last Post: 08-19-2008, 08:32 AM
  4. matrix class
    By shuo in forum C++ Programming
    Replies: 2
    Last Post: 07-13-2007, 01:03 AM
  5. i cannot see the mouse arrow
    By peachchentao in forum C Programming
    Replies: 6
    Last Post: 12-10-2006, 03:14 AM

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