// Person.cpp : main project file.

#include "stdafx.h"

using namespace System;

ref class Person
{
	String^ name;
	int dd, mm, yyyy;
	public:
		// Person class constructors
		Person() { name = nullptr; dd = 0; mm = 0; yyyy = 0; }
		Person(String^ n, int d, int m, int y)
		{
			name = n;
			dd = d; mm = m; yyyy = y;
		}

		// The Name property
		property String^ NProperty
		{
			String^ get() { return name; }
			void set(String^ s) { name = s; }
		}

		// getting the year of birth...
		property int AProperty
		{
			// The read-only Age property
			int get()
			{
				DateTime now = DateTime::Now;
				return now.Year - yyyy;
			}
		}
};

int main(array<System::String ^> ^args)
{
    // Create a Person object
	Person^ pp = gcnew Person("Mike Stone", 5,7,1971);

	// Access the Name and Age properties
	Console::WriteLine(L"Age of {0} is {1}", pp->NProperty, (Object^)pp->AProperty);

    return 0;
}

