Click here to Skip to main content
15,886,689 members
Articles / Programming Languages / C

Custom (User Defined) Operators in C++

Rate me:
Please Sign up or sign in to vote.
4.49/5 (20 votes)
15 Dec 2008CPOL8 min read 114.7K   1K   18  
C++ has no native support for adding new operators, but this article shows how, with macros and some clever overloading, it is possible to easily add your own anyway.

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

No alternatives have been posted.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Founder Mage Guys
United States United States
John is a co-founder of Priacta, Inc, a Time Management training company. Priacta's "TRO" training typically gives executives and business owners a 15-30% boost in productivity. John supervises the development side, and recently worked on the release of the new online self training system.

John's favorite languages are C++, CSS, HTML, and SQL (in that order.) He is also proficient with PHP, Javascript, and several dialects of BASIC. He generally hates interpreted languages, because they lack a compiler, making them prone to many types of bugs and abuses not found in compiled languages.

John is married to a beautiful woman and has a young son.

Comments and Discussions