Skip to content

Instantly share code, notes, and snippets.

View sevperez's full-sized avatar

Severin Perez sevperez

View GitHub Profile
using System;
namespace decorator_1
{
class Program
{
static void Main(string[] args)
{
var msg = "I love C-sharp";
var simpleMsg = new SimpleMessage(msg);
using System;
namespace decorator_0
{
class Program
{
static void Main(string[] args)
{
var msg = "I love C-sharp";
var simpleMsg = new SimpleMessage(msg);
module RunStrategies
class RunStrategyInterface
def self.run(name)
raise "Run method has not been implemented!"
end
end
class Jog < RunStrategyInterface
def self.run(name)
puts "#{name} is now jogging at a comfortable pace."
class Runner
attr_reader :name, :strategy
attr_writer :strategy
def initialize(name, strategy)
@name = name
@strategy = strategy
end
def run
class Runner
attr_reader :name
def initialize(name)
@name = name
end
def run
puts "#{@name} is now running."
end
interface IArithmetic
{
int Add(int num1, int num2);
int Subtract(int num1, int num2);
int Multiply(int num1, int num2);
double Divide(int num1, int num2);
}
using System;
namespace isp_2
{
class Program
{
static void Main(string[] args)
{
var basicStudent = new BasicMathStudent();
using System;
namespace isp_1
{
class Program
{
static void Main(string[] args)
{
var basicStudent = new BasicMathStudent();
class MadScientist < Scientist
def run_experiment(experiment)
if sabotage?
puts "#{name} is now sabotaging the #{experiment.title} experiment!"
else
puts "#{name} is now running the #{experiment.title} experiment."
end
end
private
class Laboratory
attr_accessor :scientists
def initialize(scientists, experiments)
@scientists = scientists
@experiments = experiments
end
def run_all_experiments
@scientists.each do |scientist|