Thread: class question

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    630

    class question

    Hello..

    I have a class

    Code:
    class someclass {
    public:
    	someclass (string d = "", string p = "") : domain(d) { priority = p; }
    	string domain;
    	string priority;
    };
    How should I pass p as priority to the class the same way as domain (d) not inside the { } ?

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    Add a comma, then do the same thing as you did with domain. The initializer list is a comma separated list of initializations.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. matrix class
    By shuo in forum C++ Programming
    Replies: 2
    Last Post: 07-13-2007, 01:03 AM
  2. Replies: 8
    Last Post: 10-02-2005, 12:27 AM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. question about DLL's and class functions
    By btq in forum Windows Programming
    Replies: 2
    Last Post: 02-25-2003, 06:08 AM
  5. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 06:51 PM