Root/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | #include <iostream> #include <map> #include "variant.h" class A { public : void woof() { cout << "woof" << endl; } }; class B : public A { public : void woof() { cout << "woof2" << endl; } }; int main() { variant<> v1 = 1; variant<> v2 = "2" ; variant<> v3 = v1 + v2; cout << v3 << endl; //variant<A> a = new A(); //a = 444; //a = (int)v3; //cout << a << endl; variant<A> a = new A(); variant<B> b = new B(); a = (A*)b; //variant<A> a = new A(); //variant<B> b = new B(); //a = 5; /*variant<> v = 123; variant<> v3 = 33; v3 = v; int x = v; cout << x << endl; x += 1; v = x; cout << v << endl;*/ /*string x; //cin >> x; variant<> v = "10"; cout << v << endl; v += 10;*/ //cout << v << endl; //cin >> v; //cout << v << endl; /*cout << x << endl; cout << v3 << endl; cout << v << endl; v = v + 1; cout << v << endl; variant<A> v2 = new A(); ((A)v2).f();*/ //v2 = v; //cout << v << endl; //std::map<string, variant> t; //t["test"] = 123; //cout << t["test"].getInt() << endl; /*variant v = "a"; variant v2 = "bb"; if (v < v2) cout << "true" << endl;*/ //cout << v.getString() << endl; } |
Source at commit 39ba50dd77ee created 11 years 9 months ago. By Nathan Adams, Adding source and sample |
---|