×
Log in
Twitter
Gmail
Facebook
.NET Fiddle
and
.NET Academy
shared account
Remember me
Log in
Sign up
or
Reset password
Search Tutorials
Log in
Sign up
About
Twitter
.NET Fiddle
Support
Contact Us
Classes
Exercise: Update your constructor
< Previous
Next >
Goal
Update your existing constructor to accept a value for the `DateOfBirth` property.
using System; public class Person { public Person(string firstName, string lastName) { FirstName = firstName; LastName = lastName; } public string FirstName { get; set; } public string LastName { get; set; } public DateTime DateOfBirth { get; set; } public string GetFullName() { return FirstName + " " + LastName; } public int GetAge() { return DateTime.Now.Year - DateOfBirth.Year; } } public class Program { public static void Main() { } }
Reset
Verify
Page 17 of 20
< Previous
Next >
Loading packages and dependencies