Created
October 14, 2013 19:16
-
-
Save evizitei/6980544 to your computer and use it in GitHub Desktop.
C# to Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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