Last active
October 30, 2016 08:58
-
-
Save milk19873/ff95439ba559ec0a951387961d1f6f43 to your computer and use it in GitHub Desktop.
第9回プログラミング講座(ヒープ領域)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace SimpleCalc | |
{ | |
public class Calc | |
{ | |
//このクラスで使用する変数を宣言する。 | |
public int suji1 = 0; | |
public int suji2 = 0; | |
} | |
public partial class Form1 : Form | |
{ | |
//インスタンス生成 | |
Calc CalcA = new Calc(); | |
Calc CalcB = new Calc(); | |
//「.」を使うことでクラスの内部の変数にアクセス出来る | |
CalcA.suji1 = 5; | |
CalcB.suji1 = 10; | |
//CalcBをCalcAに代入 | |
CalcA = CalcB; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment