Regardless of what you do, you want to keep a reference to question B, since the Q&A of that question will likely help most readers.
Depending on the case, I would do the following:
First, I would see whether my answer really can't be written in a way so that it's applicable to question B. For example, I could add an answer like this to question B:
Function foo
can be used to do <bla>, but it isn't suitable to do <blabla>. In that case, it's better to use function bar
.
When doing this, always make sure the answer is applicable to the question.
If I can't write the answer in such a way, I would have to make a judgment call in whether those questions are actual duplicates or just near-duplicates and if my answer would have enough of an impact to differentiate between these questions.
If question A isn't too old, I would first add a comment asking why the OP didn't use bar
. If the OP can't (for example because they're restricted to use foo
), I would keep question A closed (and perhaps edit it claryfing why the question uses foo
and not bar
). In that case, if I think my answer is really useful, I would create a separate self-answered Q&A.
If the OP didn't know about bar
or the question is really old, I would rephrase the question so that it's less about foo
, and more about the actual problem they're trying to solve. I would add a comment explaining why I think question B isn't a proper duplicate, and vote to reopen.
After reopening, I would try to make sure to keep a reference to question B. For example:
The function foo
is not a good function to <bla>. It works, but it's much better to use function bar
.
However, if you do intend to use function foo
, then <link to question B> wll answer your question.
If I don't feel like I should earn reputation for this solution (because question B still covers like most of the cases), I would add this answer as a community answer.
A/B
/foo/bar
/<bla>/<blo>
/Fake_Example_1/Fake_Example_2
/ etc..., while this Qt sounds clearly related to a specific Case/Qt, not linked to... (Or mention that you didn't want to link to it to avoid the Meta-Effect perhaps, I don't know, but I don't like "Fake" Examples in general...)