mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-05-03 08:51:30 +02:00
Add interface minitest, rework s.d.
This commit is contained in:
59
tests/mini/interface8.d
Normal file
59
tests/mini/interface8.d
Normal file
@@ -0,0 +1,59 @@
|
||||
interface InputStream
|
||||
{
|
||||
void foo();
|
||||
}
|
||||
|
||||
interface OutputStream
|
||||
{
|
||||
void bar();
|
||||
}
|
||||
|
||||
interface IConduit : InputStream, OutputStream
|
||||
{
|
||||
abstract uint bufferSize();
|
||||
}
|
||||
|
||||
class Conduit : IConduit
|
||||
{
|
||||
abstract uint bufferSize();
|
||||
abstract void foo();
|
||||
abstract void bar();
|
||||
}
|
||||
|
||||
interface Selectable
|
||||
{
|
||||
void car();
|
||||
}
|
||||
|
||||
class DeviceConduit : Conduit, Selectable
|
||||
{
|
||||
override uint bufferSize ()
|
||||
{
|
||||
return 1024 * 16;
|
||||
}
|
||||
override void foo() {}
|
||||
override void bar() {}
|
||||
override void car() {}
|
||||
int handle;
|
||||
}
|
||||
|
||||
class ConsoleConduit : DeviceConduit
|
||||
{
|
||||
override void foo() {}
|
||||
bool redirected;
|
||||
}
|
||||
|
||||
class OtherConduit : Conduit
|
||||
{
|
||||
abstract uint bufferSize();
|
||||
override void foo() {}
|
||||
override void bar() {}
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
auto c = new ConsoleConduit;
|
||||
IConduit ci = c;
|
||||
assert(c.bufferSize == ci.bufferSize);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user