language: C++ 4.7.2 (gcc-4.7.2)
date: 608 days 19 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <string>
#include <iostream>
 
struct NameType : public std::string
{
   NameType()
       : std::string( "foo" )
   {
   }
   
   operator int()
   {
        return 23;
   }
};
 
int main()
{
   NameType name;
   std::cout << name << std::endl;
   std::cout << (int)name << std::endl;
}