The board of supervisors of any county may authorize the sale of any undivided interest in any property owned by an agricultural high school and used for school purposes to any public school, and the board of supervisors may authorize the sale of an undivided interest in any public school property used for school purposes to an agricultural high school. Before an order authorizing such sale shall be effected, the boards of trustees of each of such schools shall agree in writing on the terms of such sale, and shall set out in full the extent of the rights of use and occupancy of the school and grounds each of said schools is to enjoy, and shall also agree upon the control, management and preservation of such premises. Before, however, any such contract with reference to the use, occupancy, management and control of such school buildings and grounds to be used for joint purposes is final it shall receive the approval of the county board of education.