Last active
February 24, 2018 18:32
-
-
Save sometowngeek/ab2284425d878f035362fcf3e8f0880b to your computer and use it in GitHub Desktop.
Point.cs for someone on SO
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 StackOverflow.Playground | |
{ | |
public class Point | |
{ | |
public static void Main(String[] args) | |
{ | |
Xcoord xc = new Xcoord(); | |
Console.WriteLine(String.Format("xCoor: {0}; yCoor: {1}", xc.Get_xCoor(), xc.Get_yCoor())); | |
xc.Set_xCoor(5); | |
xc.Set_yCoor(6); | |
Console.WriteLine(String.Format("xCoor: {0}; yCoor: {1}", xc.Get_xCoor(), xc.Get_yCoor())); | |
Console.ReadKey(); | |
} | |
// This is if you don't want it to be accessible outside of this class. | |
// Otherwise, I recommend using a separate file to denote entities. | |
// Use "internal" instead of "private" if you would like this class | |
// to be accessible within this project. | |
private class Xcoord | |
{ | |
// The default for int is always 0. | |
// Do not need to set xCoor or yCoor to 0. | |
private static int xCoor; | |
private static int yCoor; | |
public int Get_xCoor() | |
{ | |
return xCoor; | |
} | |
public void Set_xCoor(int value) | |
{ | |
xCoor = value; | |
} | |
public int Get_yCoor() | |
{ | |
return yCoor; | |
} | |
public void Set_yCoor(int value) | |
{ | |
yCoor = value; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment