Skip to content

Instantly share code, notes, and snippets.

View pankaj-k's full-sized avatar

ikeptwalking pankaj-k

View GitHub Profile
Radio radio = new Radio(new DuracellBattery());
Radio radio = new Radio();
public class Radio
{
public DuracellBattery Battery { get; set; }
public Radio()
{
Battery = new DuracellBattery();
}
public void Play()
{
public class DuracellBattery: IBattery
{
void Start()
{
//Some code
}
}
public interface IBattery
{
void Start();
}
@pankaj-k
pankaj-k / Radio.cs
Last active October 23, 2015 00:41
public class Radio
{
public IBattery Battery { get; set; }
public Radio(IBattery battery)
{
Battery = battery;
}
public void Play()
{