Serving the Quantitative Finance Community

 
User avatar
humtumiit
Topic Author
Posts: 0
Joined: April 28th, 2007, 6:20 pm

C++ doubt

July 4th, 2007, 9:25 am

template <class S>class price {public :price(double p) : p_(p);-----------private :double p;}what is the use of : in 4th line ? can we write like this template <class S>class price {public:price (double p){p_(p);...........}private: double p;}
Last edited by humtumiit on July 3rd, 2007, 10:00 pm, edited 1 time in total.
 
User avatar
alanxyz
Posts: 0
Joined: February 28th, 2007, 1:28 pm

C++ doubt

July 6th, 2007, 6:07 pm

I am not a good C++ programmer at all but I suggest the book: Professional C++...
 
User avatar
madmax
Posts: 0
Joined: October 31st, 2003, 9:56 am

C++ doubt

July 6th, 2007, 6:51 pm

In short you can do it your way, but you are better of using the initialization list. If you want to know why I recommend starting to study some good C++ book like Scott Meyers (3 books) or Herb Sutter (3 books).