C#, What are methods, classes, and objects? [duplicate]

this question already has answers here : What is the difference between a class and an object? (3 responses) function and method are the same thing? (2 responses) What is the difference between Struct and Class? (1 response) What is a constructor for? (6 responses) property Vs variables (1 response) Closed 1 year ago .

What are the differences between all three? Besides them have any more? I'm new to development, and I want to learn more.

Author: Aiko Kikuchi, 2019-06-13

1 answers

Properties : set of characteristics of a given class.
methods : behaviors of a class, would be equivalent to functions in a structured programming language.
Constructor : initializes an object with the passed properties.
Class : set of methods and properties that define a scope.
Object : an element with characteristics defined by a class.

public class Pessoa //Aqui é a classe e a definição de suas propriedades e comportamentos (métodos)
{
   private string Nome {get; set;}; //Propriedades da classe

   public Pessoa(string _nome) //Construtor
   {
      nome= _nome;
   }

   public string FalaNome() //Método que fala o seu nome
   {
       return "Meu nome é " + nome;
   }
}

static void Main()
{
    var pessoa = new Pessoa("Felipe"); //Aqui definimos um objeto da classe Pessoa com o nome Felipe
    Console.WriteLine(pessoa.FalaNome()); //Imprime Meu nome é Felipe no console
}
 -1
Author: Felipe Avelar, 2019-06-13 16:45:32