question about using class

Hi.. I would like to ask if my code is correct? It compiles fine.. but when I look at other codes, theirs codes are much longer...especially in the public part..

1
2
3
4
5
6
7
8
9
10
11
12
13
class Product
{
      private:
            string code, gName, bName, dForm, dStr, day, month, year, qty, price;
      
      public:
            void Add();
            string searchCode();
            void Search();
            void Edit();
            void Delete();
            void displayAll();
};


I'm just curious to know and I don't really understand between the way I put mine and the longer ones.. like each function has got stuff in them, and the name of the class (in this case Product), has a function Product(string code, gName, bName, dForm, dStr, day, month, year, qty, price){ ...} or something like that...

Thank you.. :)
That's the constructor that they be having. This will explain it a lot better than I can http://www.cplusplus.com/doc/tutorial/classes/.
AKat (9) Sep 13, 2011 at 12:19pm
That's the constructor that they be having. This will explain it a lot better than I can http://www.cplusplus.com/doc/tutorial/classes/.


great! thank you! :D
Topic archived. No new replies allowed.