Operator Overloading

VB.Net does not support operator overloading
This permits user-defined operator implementations
You can redefine the function of most built-in operators globally or on a class by class basis
Overloaded operators are implemented as functions


class MyDate 
{
   private m_Day;
   private m_Month;
   private m_Year;

   bool operator == (const myDate mdate);
   bool operator != (const MyDate mdate);
}

bool MyDate :: operator==(const MyDate mdate)
{
   return !(this -> operator == (mdate));
}
bool MyDate :: operator!=(const MyDate mdate)
{
   return (MyDate.m_Day == this.m_Day) &&
             (MyDate.m_Month == this.m_Month) &&
             (MyDate.m_Year == this.m_Year);
}


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext