Last active
December 10, 2015 20:48
-
-
Save netojoaobatista/4490256 to your computer and use it in GitHub Desktop.
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
using System; | |
namespace visibility | |
{ | |
public class Sample | |
{ | |
public static void Main (string[] args) | |
{ | |
User user = new User("Neto"); | |
User.changePrivateName(user, "João Batista Neto"); | |
user.showPrivateName(); //João Batista Neto | |
} | |
} | |
} |
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
using System; | |
namespace visibility | |
{ | |
public class User | |
{ | |
private String privateName; | |
public User(String name) | |
{ | |
privateName = name; | |
} | |
public static void changePrivateName(User user, String name) | |
{ | |
user.privateName = name; | |
} | |
public void showPrivateName() | |
{ | |
Console.WriteLine(privateName); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment