The children of such marriages shall be deemed legitimate and when the parties shall have ceased to cohabit, in consequence of the death of the woman or from any other cause, all the children of the woman, recognized by the man to be his, shall be deemed legitimate.