If any officer, for performing an official duty for which a fee or compensation is allowed or provided by law, knowingly demand and receive a greater fee or compensation than is so allowed or provided, he shall be guilty of a Class 4 misdemeanor.
Code 1950, § 18.1-304; 1960, c. 358; 1975, cc. 14, 15.