Menu
Home
Create new Paste
Log in
Code
Theme: cobalt
Theme: eclipse
Theme: elegant
Theme: monokai
Theme: neat
Theme: night
Theme: rubyblue
int ptr = 123; interface IRoot { } interface IBase1 : IRoot { } interface IBase2 : IRoot { } class Base1 : IBase1 { void* cppObj; this() { cppObj = &ptr; } } class Base2 : IBase2 { void* cppObj; this() { cppObj = &ptr; } } class MIClass : IBase1, IBase2 { void* cppObj; this() { cppObj = &ptr; } } void test(IRoot root) { int** ptr = cast(int**)root - 1; assert(**ptr == 123); // pass } void main() { test(new Base1); test(new Base2); test(new MIClass); }
Result:
Success
/
Return code: 0
/
Compilation time:
0.104
seconds
/
Run time:
0.001
seconds
Paste info
Author:
Guest
Views:
156
Private:
no
Expires:
Never
Uploaded:
19.09.12 18:47
Votes
:
0
Tweet
Compilation
Compiler:
DMD 2.060
Pointer size:
m32
Actions
Download
Fork
Raw
×
Confirm
Are you sure you want to delete this paste?
There's no way back!
×
Confirm
Reason