My understanding is the same as the one that Servy presents in the comments captured above.
Question A is a duplicate of Question B if the answers to Question B answer Question A.
That said, there are some other considerations.
First, Question B may answer parts of, but not the entirety of, Question A. In that case, Question B should be linked to in the comments of Question A. This also causes it to show up in the sidebar of Question B. If necessary, answers can also link to one or more answers of Question A as supporting information.
Second, the answer to Question B cannot be hidden in one or more answers to Question A. The answer should be clearly obvious by reading the answers to Question B. If the answer is hidden away in a link to an external resource or a small aside, then Question B is not a duplicate at all.
Third, if both questions have answers, the quality of those answers should be used when considering duplication. Question A may be older, but if Question B attracted sufficiently high quality answers, then Question A should be marked as a duplicate of Question B.
See:
The Wikipedia of Long Tail Programming Questions:
If you're going to close a user's question as a duplicate, it has to be a real duplicate. For example, if a user asks, "What does the IP address 128.0.1.1/24 mean?" it's OK to close that as a duplicate of a more general question like "What do IP addresses of the form a.b.c.d/e mean?" But it's not OK to close it as a duplicate of a twenty-seven page guide to netmasks.
Handling Duplicate Questions discusses three kinds of duplicates. Two are easily closable as duplicates (the "cut-and-paste duplicate questions" and "accidental duplicates"). The third, the "borderline duplicate" covers the case that I describe above.
I would like to generally speak about voting to close as a duplicate, as well. One person's vote to close is a single opinion, one that just happens to leave an autogenerated comment that includes a link to the question they picked as a duplicate. That autogenerated comment does not need to be flagged as non-constructive, rude, or offensive. However, you can flag if Also, you do not need to engage with people over a single close vote. I'd ask that no one votes blindly - if someone has suggested a question as a duplicate, read both questions and, if you feel they are duplicates, vote with them. If you don't feel that way, then don't vote to close as a duplicate. If the question has several close votes that you feel are inappropriate, then you should open a specific-question discussion here on Meta.