Unity Developer Question:

Download Job Interview Questions and Answers PDF

Tell us what is Operator Overloading and how does it work?

Unity Developer Interview Question
Unity Developer Interview Question

Answer:

Most of the built-in operators available in C# can be overloaded or redefined using the operator keyword. The sample code below depicts the syntax used to implement the addition operator (+) for a user-defined class.

public static Rectangle operator+ (Rectangle b, Rectangle c)
{
Rectangle rectangle = new Rectangle();
rectangle.length = b.length + c.length;
rectangle.breadth = b.breadth + c.breadth;
rectangle.height = b.height + c.height;
return rectangle;
}

Download Unity Developer Interview Questions And Answers PDF

Previous QuestionNext Question
Tell us what do you consider ethical spending on an expense account?Tell us what is your biggest fear?