0

I have implemented a Matrix class implementation for matrix manipulation, and so far i can overload ordinary (single) operators such as +, *, ...

I want to do Matrix elementary multiplication by overloading the operator (.*), such as i can write

Matrix A(5,3), B(5, 3), C;
C = A .* B;

C, in this case, will hold the value of multiplication element by element from A and B (A and B have same dimensions)

rachid el kedmiri
  • 2,146
  • 2
  • 17
  • 36

2 Answers2

5

From this operator overloading reference

Restrictions

  • The operators :: (scope resolution), . (member access), .* (member access through pointer to member), and ?: (ternary conditional) cannot be overloaded.

In short, it's not possible to overload the "dot" member access operators like .*.

Some programmer dude
  • 380,411
  • 33
  • 383
  • 585
3

Here you can see the "pointer to member of object" .* operator is not overloadable in c++.

Hawky
  • 441
  • 1
  • 3
  • 10