Head First C# Code: Chapter 7 Fingers the Clown Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace __Fingers_the_Clown
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public class FunnyFunny : IClown {
public FunnyFunny(string funnyThingIHave) {
this.funnyThingIHave = funnyThingIHave;
}
protected string funnyThingIHave;
public string FunnyThingIHave {
get { return "Honk honk! I have " + funnyThingIHave; }
}
public void Honk() {
MessageBox.Show(this.FunnyThingIHave);
}
}
public class ScaryScary : FunnyFunny, IScaryClown {
public ScaryScary(string funnyThingIHave, int numberOfScaryThings)
: base(funnyThingIHave) {
this.numberOfScaryThings = numberOfScaryThings;
}
private int numberOfScaryThings;
public string ScaryThingIHave {
get { return "I have " + numberOfScaryThings + " spiders"; }
}
public void ScareLittleChildren() {
MessageBox.Show("Boo! Gotcha! You can't have my " + base.funnyThingIHave);
}
}