3 Replies Latest reply on Jul 6, 2009 1:43 PM by Tolls

    Call a method of a class in a constructor of another class?

      Is this good programming or should i do it in another way?

      Consider an ordering system, where I have three classes, "Booking", "Table" and "Customer.

      My idea is to create a booking assigned to a table and a customer, the fields in the booking class is a Customer and a Table and the constructor assigns values to these field.

      In my Table class i have a method that books the table "bookTable(Customer customer)" and sets the availablility to 'false'.

      So my question is, is it good programming to call the method 'bookTable()' in the table class from the constructor of the Booking class? Or should i do it in another way?

      Edited by: DJHingapus on Jul 6, 2009 5:12 AM