namespace PraticandoEncapsulamento.Classes;
internal class Projeto
{
//Atributos
public string Nome { get; }
private List<string> Tarefas { get; }
//Construtor
public Projeto(string nome)
{
Nome = nome;
Tarefas = new List<string>();
}
//Métodos
public void AdicionarTarefa(string tarefa)
{
Tarefas.Add(tarefa);
}
public void ExibirTarefas()
{
Console.WriteLine($"Projeto: {Nome}\nTarefas:");
foreach (var tarefa in Tarefas)
{
Console.WriteLine($"- {tarefa}");
}
Console.WriteLine($"Total:{Tarefas.Count} tarefas");
}
}
using PraticandoEncapsulamento.Classes;
Projeto projeto = new Projeto("Sistema de Inventário");
projeto.AdicionarTarefa("Criar tela de login");
projeto.AdicionarTarefa("Implementar banco de dados");
projeto.ExibirTarefas();