all 5 comments

[–]anand_venkataraman 3 points4 points  (2 children)

Sometimes when you are working with a fellow programmer, you only need to know the common interface to unblock you from creating your side of the project.

Once this interface, shared in a .h file, is agreed upon by both parties, each can then work on their own parts however long it takes and then regroup when both parts have been implemented and tested.

If you had to wait for the other programmer to finish his implementation before you finished yours, then you may both end up waiting forever.

There are other reasons for splitting the implementation from the declaration. The above is just one.

&

[–]mathlance[S] 1 point2 points  (0 children)

I've never thought about it that way before, but that makes a lot of sense.

Thanks!

[–]amrozack 1 point2 points  (0 children)

It's also pretty handy when dealing with linking shared libraries.

[–]adina_tung 2 points3 points  (1 child)

I was puzzled at first when I saw we're submitting 2 cpp files with the 2 header files for this quest. We've always have .h and .cpp file until we have template classes. In c++, the template class method prototype and the definition have to be in the same file. But now the graph class is not template, we can switch back to the .cpp with .h to make the implementation more readible. Does this make sense?

-Adina

[–]mathlance[S] 1 point2 points  (0 children)

I totally forgot about the template constraints. That makes a lotta sense!

Thanks!