Page 1 of 1
C++ doubt
Posted: July 4th, 2007, 9:25 am
by humtumiit
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;}
C++ doubt
Posted: July 6th, 2007, 6:07 pm
by alanxyz
I am not a good C++ programmer at all but I suggest the book: Professional C++...
C++ doubt
Posted: July 6th, 2007, 6:51 pm
by madmax
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).