Thread: const string init in the header possible

  1. #1
    Registered User kroiz's Avatar
    Join Date
    Jun 2007
    Posts
    116

    const string init in the header possible

    life are not fair!

    Code:
    // foo.h
    class foo
    {
        static const int pi=314;  // ok 
        static const char* const dora="dora explora.";
    }
    is there a way to declare a string like that in the header?

    I know I can initialize it in the cpp but I think that if I could put all the class's constants in one place the code will be more readable.

  2. #2

  3. #3
    Registered User kroiz's Avatar
    Join Date
    Jun 2007
    Posts
    116
    bummer

    thanks pheres.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help implementing a class
    By jk1998 in forum C++ Programming
    Replies: 8
    Last Post: 04-05-2007, 03:13 PM
  2. Custom String class gives problem with another prog.
    By I BLcK I in forum C++ Programming
    Replies: 1
    Last Post: 12-18-2006, 03:40 AM
  3. Another overloading "<<" problem
    By alphaoide in forum C++ Programming
    Replies: 18
    Last Post: 09-30-2003, 10:32 AM
  4. Half-life SDK, where are the constants?
    By bennyandthejets in forum Game Programming
    Replies: 29
    Last Post: 08-25-2003, 11:58 AM
  5. "Operator must be a member function..." (Error)
    By Magos in forum C++ Programming
    Replies: 16
    Last Post: 10-28-2002, 02:54 PM