1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Adress adress1 = new Adress("Europaris", "xxx-xxxx-xxxx", "europaris@xxx.xx.xx");
Adress adress2 = new Adress();
adress1.show();
adress2.show();
Console.ReadLine();
}
}
class Adress
{
protected string name; //名前を保持
protected string tell; //電話番号を保持
protected string mail; //メールアドレスを保持
public Adress(string str1, string str2, string str3) //コンストラクタ
{
name = str1;
tell = str2;
mail = str3;
}
public Adress()
{
name = "未登録のデータです";
tell = "未登録のデータです";
mail = "未登録のデータです";
}
public void show()
{
Console.WriteLine("------------アドレス情報------------");
Console.WriteLine(
String.Format("名前:{0}\n電話番号:{1}\nメールアドレス:{2}"
, name, tell, mail));
}
}
} |