using System.Collections.Generic;
public string Name { get; set; }
public string Location { get; set; }
public int Age { get; set; }
public void SetAttributes(string name, string location, int age)
public string Title { get; set; }
public int Duration { get; set; }
public List<Actors> Cast { get; set; }
Cast = new List<Actors>();
public void SetAttributes(string title, int duration, List<Actors> cast)
public void PrintDetails()
Console.WriteLine("Movie Title: " + Title);
Console.WriteLine("Duration: " + Duration + " mins");
Console.WriteLine("Cast:");
foreach (var actor in Cast)
Console.WriteLine("- "+ actor.Name + " " + actor.Age + " , " + actor.Location);
public static void Main()
var actor1 = new Actors();
actor1.SetAttributes("Tom Hanks", "Los Angeles", 65);
var actor2 = new Actors();
actor2.SetAttributes("Emma Watson", "London", 31);
var cast = new List<Actors>() { actor1, actor2 };
var movie = new Movies();
movie.SetAttributes("The Terminal", 128, cast);