'How to create an Address field into this Company class [closed]

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; }

}


Solution 1:[1]

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;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nick Tiberi