Skip to content

Instantly share code, notes, and snippets.

@evizitei
Created October 14, 2013 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evizitei/6980544 to your computer and use it in GitHub Desktop.
Save evizitei/6980544 to your computer and use it in GitHub Desktop.
C# to Ruby
public class Person
{
// Field
public string name;
// Constructor that takes no arguments.
public Person()
{
name = "unknown";
}
// Constructor that takes one argument.
public Person(string nm)
{
name = nm;
}
// Method
public void SetName(string newName)
{
name = newName;
}
}
class Person
attr_reader :name
def initializer(nm = 'unknown')
@name = nm
end
def set_name(new_name)
@name = new_name
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment