initial check in
This commit is contained in:
29
typedefed_operators.cpp
Normal file
29
typedefed_operators.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <iostream>
|
||||
typedef long mylong;
|
||||
|
||||
class A
|
||||
{
|
||||
public:
|
||||
|
||||
int val;
|
||||
|
||||
operator mylong ()
|
||||
{
|
||||
return (mylong)val;
|
||||
}
|
||||
|
||||
operator long ()
|
||||
{
|
||||
return (long)val;
|
||||
}
|
||||
};
|
||||
|
||||
int main ( void )
|
||||
{
|
||||
A o;
|
||||
o.val = 30;
|
||||
|
||||
std::cout << (mylong)o << std::endl;
|
||||
std::cout << (long)o << std::endl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user