42 lines
No EOL
485 B
C++
42 lines
No EOL
485 B
C++
#include <cstdio>
|
|
#include <cstdlib>
|
|
#include <iostream>
|
|
#include <cstring>
|
|
#include <list>
|
|
#include <set>
|
|
#include <unordered_map>
|
|
#include <time.h>
|
|
#include <math.h>
|
|
|
|
using namespace std;
|
|
|
|
class A
|
|
{
|
|
int i;
|
|
|
|
public:
|
|
A(int ii = 0) : i(ii) {}
|
|
void show() { cout << i << endl; }
|
|
};
|
|
|
|
class B
|
|
{
|
|
int x;
|
|
|
|
public:
|
|
B(int xx) : x(xx) {}
|
|
operator A() const { return A(x); }
|
|
};
|
|
|
|
void g(A a)
|
|
{
|
|
a.show();
|
|
}
|
|
|
|
int main()
|
|
{
|
|
B b(10);
|
|
g(b);
|
|
g(20);
|
|
return 0;
|
|
} |