Please,
I have a question if exists in Perl somethink like keyword
'operator' in C++ ?


for example we can write in C++ :
class A {
A() { printf("Constructor of object class A\n"); }
~A() { printf("Destructor of object class A\n"); }
};
A &operator + (A &a1, A &a2) { printf("Addition\n"); }
A &operator * (A &a1, A &a2) { printf("Multiplication\n"); }

int main() {
A a,b,c;
c = (a+b*a);
}
And (if I well compile in my mind) it writes off :
Constructor of object class A
Constructor of object class A
Constructor of object class A
Multiplication
Addition
Destructor of object class A
Destructor of object class A
Destructor of object class A

Can I write similar code in Perl or Perl is not able to analyse
like that ? Then I would not write c = a + b; but c = operator_+(a,
b); 

Thanks a lott Tomas




Reply via email to