Because add
works on header
objects, add
is a member function of the header
class. Because
add
adds a pointer to a new railroad_car
object, provided as
an ordinary argument, add
must have a parameter that is declared to
be a pointer to a railroad_car
object. Because there is to be no
return value, add
's return type is void
:
class header { public: link *first_link_pointer; header ( ) { first_link_pointer = NULL; } void add (railroad_car *new_element) { ... } ... };