Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

function, operator, or method?

function method operator
0
Posted

function, operator, or method?

0

If the class is sealed, you are kinda screwed. Use a bridge or adapter pattern. If the class is not sealed, you can inherit and use a strategy pattern. You can overload operators in C#. You can declare both explicit and implicit type conversions. You can even cause overloaded operators to return some other type. For example causing == to return a non-bool type seems stupid, but in certain cases (see NHibernate Query Generator) it makes for very readable code.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123