Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- interface IPt {
- float X { get; }
- float Y { get; }
- }
- class Pt: IPt {
- public float X { get; set; }
- public float Y { get; set; }
- }
- class Test {
- static void printPts(IPt[] pts) {
- foreach (IPt pt in pts) {
- Console.WriteLine("({0}, {1})", pt.X, pt.Y);
- }
- }
- static void Main() {
- var pts = new Pt[] {
- new Pt { X = 0, Y = 1 },
- new Pt { X = 1, Y = 1 },
- new Pt { X = 1, Y = 0 },
- new Pt { X = 0, Y = 0 }
- };
- printPts(pts);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement