Перенос страниц
This commit is contained in:
parent
4d57446057
commit
4c954c9186
129 changed files with 14 additions and 15 deletions
25
book/01-знакомство-с-языком-d/src/chapter-1-7/app.d
Normal file
25
book/01-знакомство-с-языком-d/src/chapter-1-7/app.d
Normal file
|
@ -0,0 +1,25 @@
|
|||
import std.stdio;
|
||||
|
||||
struct MyStruct
|
||||
{
|
||||
int data;
|
||||
}
|
||||
|
||||
class MyClass
|
||||
{
|
||||
int data;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
// Играем с объектом типа MyStruct
|
||||
MyStruct s1;
|
||||
MyStruct s2 = s1;
|
||||
++s2.data;
|
||||
writeln(s1.data); // Печатает 0
|
||||
// Играем с объектом типа MyClass
|
||||
MyClass c1 = new MyClass;
|
||||
MyClass c2 = c1;
|
||||
++c2.data;
|
||||
writeln(c1.data); // Печатает 1
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue