Bug 414 – interfaces shouldn't be able to inheit from classes
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-10-09T09:42:00Z
Last change time
2014-02-15T13:21:13Z
Keywords
accepts-invalid
Assigned to
bugzilla
Creator
davidl
Comments
Comment #0 by davidl — 2006-10-09T09:42:10Z
http://paste.dprogramming.com/dpi6v8ch.php
interfaces shouldn't be able to inheit from classes
import std.c.stdio;
import std.stdio;
interface a{
int c();
}
void main()
{
class b:a{
int c(){writefln("b.c");return 1;}
}
class c:b{
int c(){writefln("c.c");return 1;}
}
class f:b{
int k(){writefln("f.k");return 1;}
}
interface u:c,f,a{
int c();
int k();
}
class d:u
{
int c(){writefln("d.c");return 2;}
int k(){writefln("d.k");return 2;}
}
d a= new d;
c v= cast(c)a;
f newf=cast(f)a;
a.k(); //prints d.k
newf.k(); //access violation
v.c(); //access violation
}