A
ankitks
Hello programmers,
I am trying to write a class which has a two operators # and <=, so
that I can do something like this.
...
Array mArray;
.....
#4 mArray <= 5; //is this possible to have for # operator to have
nothing on LHS, I can get <= operator work, mArray <=5, but can't think
of anyway to combined both operator togeather! can return refrence to
Array in <= operator to do something like (4# mArray <= 5) to work.
Idealy I like to have #4 mArray <= 5;
but I can live with some other versions, 4# mArray <= 5 or (mArray <=
5) #4 (really not prefer this!)
Any suggestions, comments, help?
class defination for Array
class Array
{
public:
Array();
~Array():
operator<= (const int inIndex) {mIndex = inIndex;}
friend ?? operotor# (const Array& in Array)
private:
int mIndex;
};
I am trying to write a class which has a two operators # and <=, so
that I can do something like this.
...
Array mArray;
.....
#4 mArray <= 5; //is this possible to have for # operator to have
nothing on LHS, I can get <= operator work, mArray <=5, but can't think
of anyway to combined both operator togeather! can return refrence to
Array in <= operator to do something like (4# mArray <= 5) to work.
Idealy I like to have #4 mArray <= 5;
but I can live with some other versions, 4# mArray <= 5 or (mArray <=
5) #4 (really not prefer this!)
Any suggestions, comments, help?
class defination for Array
class Array
{
public:
Array();
~Array():
operator<= (const int inIndex) {mIndex = inIndex;}
friend ?? operotor# (const Array& in Array)
private:
int mIndex;
};