add structcons
This commit is contained in:
1 parent
e166405e4a
commit
a80d95a714
3 files changed
+38
No files matched your search
@@ -5,3 +5,4 @@ appending/appending
|
|||||||
import/import
|
import/import
|
||||||
compclass/compclass
|
compclass/compclass
|
||||||
copy/copy
|
copy/copy
|
||||||
|
structcons/structcons
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
|
||||||
|
TARGET := structcons
|
||||||
|
|
||||||
|
all: $(TARGET)
|
||||||
|
|
||||||
|
$(TARGET): $(TARGET).d
|
||||||
|
|
||||||
|
%: %.d
|
||||||
|
gdc -o $@ $<
|
||||||
|
|
||||||
|
clean:
|
||||||
|
-rm -f *.o *~ $(TARGET)
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
import std.stdio;
|
||||||
|
|
||||||
|
struct Yoda
|
||||||
|
{
|
||||||
|
int one;
|
||||||
|
int two;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Second
|
||||||
|
{
|
||||||
|
int one;
|
||||||
|
int two;
|
||||||
|
this(int _one, int _two)
|
||||||
|
{
|
||||||
|
one = _two;
|
||||||
|
two = _one;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void main(string args[])
|
||||||
|
{
|
||||||
|
writefln("%s, %s", Yoda(1,2).one, Yoda(3,4).two);
|
||||||
|
writefln("%s, %s", Second(1,2).one, Second(3,4).two);
|
||||||
|
}
|
||||||
Reference in new issue
Block a user