We know that the Stieffel Whitney class of tangent bundle of $M$ can be computed and integrated over the $M$ to get a nontrivial integration If I understand correctly, $$ \int_{M=\mathbb{RP}^2} w_1(M)^2=1 $$ $$ \int_{M=\mathbb{RP}^4} w_1(M)^4=1 $$
My question is that are there some proper characteristic classes, say $A$ and $B$ detect the $\mathbb{CP}^1$ and $\mathbb{CP}^2$? $$ \int_{M=\mathbb{CP}^1} (\text{characteristic classes }A)=1 $$ $$ \int_{M=\mathbb{CP}^2} (\text{characteristic classes } B)=1 $$