If you want to call base class constructor, you should do it this way:
B::B(float r) : A(r) {
...
}
I'm not sure what causes an error in your first example, but I can assume that compiler treats
B::B(float r) {
A(r);
}
as an attempt to initialize new variable
r
of type
A
. This variable name conflicts with constructor's argument name, and thus you get an error of parameter redefinition (
float r
being redefined as
A r
)