Q: How to create an Address field into this Company class I want to set up the Company class to be able to use the Address declared in the public static void Main(), how can I create a field for address in the company class?
class Program
{
    public static void Main()
    {
        var address = new Address("56 Main St", "Mesa", "AZ", "38574");
        var testCompany = new Company("testCompany");
        
    }
    
}

public class Address
{
    public string Street { get; set; }
    public string City { get; set; }
    public string State { get; set; }
    public string ZipCode { get; set; }

    public Address(string Street, string City, string State, string ZipCode)
    {

    }
}

public class Company
{
    public string CompanyName { get; set; }

}


A: You almost have it. You just need to require an Address in your constructors and set a corresponding property with that passed in address.
public class Address
{
    public string Street { get; set; }
    public string City { get; set; }
    public string State { get; set; }
    public string ZipCode { get; set; }

    public Address(string street, string city, string state, string zipCode)
    {
        Street = street;
        City = city;
        State = state;
        ZipCode = zipCode;
    }
}

public class Customer
{
    public long Id { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public Address Address { get; set; }

    public Customer(long id, string firstName, string lastName, Address address)
    {
        Id = id;
        FirstName = firstName;
        LastName = lastName;
        Address = address;
    }


}

public class Company
{
    public string CompanyName { get; set; }
    public Address Address { get; set; }

    public Company(string companyName, Address address)
    {
        CompanyName = companyName;
        Address = address;
    }
}

Then your desired code will work:
var address = new Address("56 Main St", "Mesa", "AZ", "38574");
var customer = new Customer("John", "Doe", address);
var company = new Company("Google", address);


A: Add an Address field in the Customer and Company classes, e.g. public Address MyAddress { get; set; }.
You can then use it like this:
var company = new Company();
Company.MyAddress = address;

