문제

I think of a situation when one needs to code a linked list implementation as a generic ADT. Is he supposed to provide within the library printing functions?

Because is we assume that the client will use the linked list with his own created struct than how can the printing method know how to print the data of that struct?

도움이 되었습니까?

해결책

A list has many inherent abilities. Printing is not one of them. For the sake of purity, I would not implement printing if I were asked to implement a linked list. Seperation of concerns is the guideline here.

On the other hand, the only correct answer is "ask your boss". If you are supposed to code this for someone, ask him. He will know better what he expects than a few random people on the internet.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top