需求工程的一道题目,熟悉点人的帮我解答下
You want to replace a function f with a more efficient function g. Provided f and g have identical signatures (prototypes), how do their specifications (in terms of pre-and post-conditions) have to relate for your program to remain correct?
a) Pre of g must be weaker than pre of f, but post of g must be stronger than post of f.
b) Pre of g must be stronger than pre of f, but post of g must be weaker than post of f.
c) Pre and post of g must be stronger than pre and post of f.
d) Pre and post of g must be weaker than pre and post of f.
我理解是功能g要代替f,前置条件肯定要弱于f,但是我不理解这里的post-conditions是指g对后面的条件,还是后面接口所需具备的条件
如果是前者,就应该是强于f,答案选A,如果后者就是弱于F,答案选D
有谁这方面比较熟,帮我解答下?