6 місяців тому
батько
коміт
76ea1022b2

+ 1 - 0
04_1_Metody/04_1_Metody.csproj

@@ -47,6 +47,7 @@
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Class1.cs" />
+    <Compile Include="Class2.cs" />
     <Compile Include="Ext.cs" />
     <Compile Include="Form1.cs">
       <SubType>Form</SubType>

+ 15 - 0
04_1_Metody/Class1.cs

@@ -11,5 +11,20 @@ namespace _04_1_Metody
     public string S { get; set; }
     public DateTime d;
     public int[] t;
+
+    public Class1()
+    {
+      S = "Dzień dobry";
+      d = DateTime.Today;
+      t = new int[] { 1, 2, 3 };
+    }
+
+
+    public Class1(string s, DateTime d, int[] t)
+    {
+      S = s;
+      this.d = d;
+      this.t = t;
+    }
   }
 }

+ 30 - 0
04_1_Metody/Class2.cs

@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace _04_1_Metody
+{
+  public class Class2 : Class1
+  {
+    public double X;
+    public double Y;
+
+    public Class2() : base()
+    {
+      X = Math.PI;
+    }
+
+    public Class2(string s, DateTime d, int[] t, double x) : base(s, d, t)
+    {
+      X = x;
+    }
+
+    public Class2(string s, DateTime d, int[] t, double x, double y) : this(s, d, t, x)
+    {
+      Y = y;
+    }
+
+  }
+}

+ 13 - 0
04_1_Metody/Form1.Designer.cs

@@ -35,6 +35,7 @@
       this.button5 = new System.Windows.Forms.Button();
       this.button6 = new System.Windows.Forms.Button();
       this.button7 = new System.Windows.Forms.Button();
+      this.button8 = new System.Windows.Forms.Button();
       this.SuspendLayout();
       // 
       // button1
@@ -107,11 +108,22 @@
       this.button7.UseVisualStyleBackColor = true;
       this.button7.Click += new System.EventHandler(this.button7_Click);
       // 
+      // button8
+      // 
+      this.button8.Location = new System.Drawing.Point(683, 112);
+      this.button8.Name = "button8";
+      this.button8.Size = new System.Drawing.Size(99, 41);
+      this.button8.TabIndex = 7;
+      this.button8.Text = "base";
+      this.button8.UseVisualStyleBackColor = true;
+      this.button8.Click += new System.EventHandler(this.button8_Click);
+      // 
       // Form1
       // 
       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
       this.ClientSize = new System.Drawing.Size(800, 450);
+      this.Controls.Add(this.button8);
       this.Controls.Add(this.button7);
       this.Controls.Add(this.button6);
       this.Controls.Add(this.button5);
@@ -134,6 +146,7 @@
     private System.Windows.Forms.Button button5;
     private System.Windows.Forms.Button button6;
     private System.Windows.Forms.Button button7;
+    private System.Windows.Forms.Button button8;
   }
 }
 

+ 9 - 0
04_1_Metody/Form1.cs

@@ -99,5 +99,14 @@ namespace _04_1_Metody
       MessageBox.Show($"{c.DodajDoDtDni(3)}");
 
     }
+
+    private void button8_Click(object sender, EventArgs e)
+    {
+      //Class2 c2 = new Class2();
+
+      //Class2 c2b = new Class2("Ala ma kota...", new DateTime(1999,1,1), null, 667);
+
+      Class2 c2c = new Class2("Ala ma kota...", new DateTime(1999, 1, 1), null, 667, 1975);
+    }
   }
 }