開発環境
- OS: Windows 10 Pro
- IDE(統合開発環境): Visual Studio Community 2017
Head First C# ―頭とからだで覚えるC#の基本 (Andrew Stellman (著)、Jennifer Greene (著)、佐藤 嘉一 (監修, 監修)、木下 哲也 (翻訳)、オライリージャパン)の3章(オブジェクト指向になる! - わかりやすいコードにする)、自分で考えてみよう(p. 107)を取り組んでみる。
コード
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp6
{
// クラス名を修正
class CandyMachine
{
void CandyBarWeight() { }
void PrintWrapper() { }
void GenerateReport() { }
// Goというメソッド名が分かりにくい
}
// GuyとGirlのすることに違いはないので1つのクラスに統合
class DeliveryPerson
{
void AddAPizza() { }
void PizzaDelivered() { }
void TotalCash() { }
void ReturnTime() { }
}
class CashRegister
{
void MakeSale() { }
void NoSale() { }
// PumpGasを削除
void Refund() { }
void TotalCashInRegister() { }
void GetTransactionList() { }
void AddCash() { }
void RemoveCash() { }
}
static class Program
{
/// <summary>
/// アプリケーションのメイン エントリ ポイントです。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
0 コメント:
コメントを投稿