Rational(long n,long d):N(n),D(d)

msdagiya (26)
A constructor is declared inside a class. but I didn't understand what N(n) and D(d) are. note that N and D are two private members of class Rational. does any one know?

Rational(long n,long d):N(n),D(d){

}
Chervil (812)
It's initialisation. The effect is similar to this:
1
2
3
4
Rational(long n,long d) {
    N = n;
    D = d;
} 

Registered users can post here. Sign in or register to post.