J
J
Julia2016-09-15 22:15:06
C++ / C#
Julia, 2016-09-15 22:15:06

How to redefine the & operator?

Good evening.
I have a SearchVector class. The job is to redefine the & operator.
So the code below would work

int n=3;
     bool b3 = (n & v);
     n=23;
     bool b23 = (n & v);
     n=5;
     bool b5 = (n & v);

My failed code attempt:
bool operator&( const T & rhs , const SearchVektor<T> & s)     
{ 

//TODO 

    return true; 
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Moseychuk, 2016-09-16
@Julila

template<typename T>
bool operator&( const T & rhs , const SearchVektor<T> & s)     
{ 

//TODO 

    return true; 
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question