Skip to content

Instantly share code, notes, and snippets.

ikeptwalking pankaj-k

Block or report user

Report or block pankaj-k

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Client.cs
Radio radio = new Radio(new DuracellBattery());
View Client.cs
Radio radio = new Radio();
View Radio.cs
public class Radio
{
public DuracellBattery Battery { get; set; }
public Radio()
{
Battery = new DuracellBattery();
}
public void Play()
{
View DuracellBattery.cs
public class DuracellBattery: IBattery
{
void Start()
{
//Some code
}
}
View IBattery.cs
public interface IBattery
{
void Start();
}
View Radio.cs
public class Radio
{
public IBattery Battery { get; set; }
public Radio(IBattery battery)
{
Battery = battery;
}
public void Play()
{
You can’t perform that action at this time.