Operational compass

xiaoxiao2021-03-06  69

// Operation is heavy plant //2004.9.4using system;

Class complex {

Double R, V;

Public Complex (Double R, Double V) {

THIS.R = R;

THIS.V = V;

}

// Recent plus method (binary)

Public Static Complex Operator (Complex A, Complex B) {

Return New Complex (A.R B.R, A.V B.V);

}

// Reproduce the negative operator (1 yuan)

PUBLIC Static Complex Operator - (Complex a) {

Return New Complex (-A.R, -A.V);

}

// Recent self-intensive operator (one yuan)

Public Static Complex Operator (Complex a) {

Double R = a.r 1;

Double v = a.v 1;

Return New Complex (R, V);

}

Public void print () {

Console.writeline (R "," V);

}

}

// Execute class class test {

Public static void main () {

Complex a = new complex (3, 4);

Complex b = new complex (5,6);

Complex c = -a;

C.Print ();

Complex D = A B;

D.print ();

a.print ();

Complex E = a ;

a.print ();

E.Print ();

Complex f = a;

a.print ();

F.Print ();

}

}

转载请注明原文地址:https://www.9cbs.com/read-120316.html

New Post(0)