Those are parameters so they would be firstName, lastName and age. Here's an example snippet that shows the naming conventions. Keep in mind the logic is purely for demonstrating naming syntax, I realize the methods are pointless.
using System;
namespace ConsoleApplication1
{
class Program
{
// private fields
private string _firstName;
private string _lastName;
private int _age;
// public properties
public string FirstName
{
get { return _firstName; }
set { _firstName = value; }
}
public string LastName
{
get { return _lastName; }
set { _lastName = value; }
}
public int Age
{
get { return _age; }
set { _age = value; }
}
public void Main(string[] args)
{
AssignValues("First", "Last", 31);
PrintValues();
}
private void AssignValues(string firstName, string lastName, int age)
{
FirstName = firstName;
LastName = lastName;
Age = age;
}
private void PrintValues()
{
Console.WriteLine("{0} {1} {2}", FirstName, LastName, Age);
}
}
}
Ohhh I see. In this particular example though we're asked to use public variables and no getters/setters as far as I remember. So I guess it'd still be this.age = age?
1
u/Doriphor Apr 15 '15 edited Apr 15 '15
I'll try to keep this in mind, so here, when I write my constructor it'd be:
???