Fires are classified based on their fuel into classes A, B, and C. Class A fires involve solid fuels like wood and paper, while class B fires involve flammable liquids. Different types of fire extinguishers can effectively extinguish different fire classes: water extinguishers work for class A fires, chemical powder works for class B, foam works for both A and B, and carbon dioxide works for B and C. Foam extinguishers work by forming an air foam that blankets the fuel surface and excludes oxygen to prevent further burning.