/******************************************************************************/ /* */ /* FILE: august.cpp */ /* */ /* Would you agree that "operator Result()" is fascinating ? */ /* ========================================================= */ /* */ /* Compiled and tested with Visual C++ V6.0 */ /* */ /* V1.00 31-AUG-2002 P. Tellenbach http://www.heimetli.ch/ */ /* */ /******************************************************************************/ #include <iostream> template< bool flag > class Template { public: ~Template() { std::cout << "Hello " ; } } ; template<> class Template<true> { public: ~Template() { std::cout << "world !\n" ; } } ; template< typename First, typename Second, typename Result > class Object : public First, public Second { public: operator Result() { return Result() ; } ; } ; int main() { return Object<Template<true>,Template<false>,int>() ; }
Update 31. August 2022
This program compiles and runs without any changes.