Skip to main content
1 of 3
Reece
  • 51
  • 1
  • 1
  • 2

Is this correct?

Idea: A class that has two properties; name and surname, and a function that returns the first name and the surname together.

Is there anything that can be done better? Anything that is done poorly?

public class Person
{
    private string Firstname { get; set; }
    private string Surname { get; set; }

    public Person(string firstname, string surname)
    {
        this.Firstname = firstname;
        this.Surname = surname;

    }
    public string GetFullName()
    {
        string fullname = String.Format("Firstname is: {0}, Surname is {1}", Firstname, Surname);
        return fullname;
    }
}

}

Reece
  • 51
  • 1
  • 1
  • 2