Bayesian classification works a bit like this: You have a set of inputs and a set of targets. By having seen a history of elements of the powerset of inputs and its manually tagged classes, the bayesian classificator learns how to classify new elements of the powerset of inputs.
Thus, a bayesian classifier has to know the classes and the inputs before. It cannot extrapolate from the sets it was trained on, since the bayesian approach does not see numbers as something that some operations are defined on, but only as symbols.
A simple backprop neural network can learn addition, though.