Can a class be a data type?

4

What I understand about data type is that they are formed by three properties, they are:

  • Address set;
  • Operations Set;
  • Memory Space;
  • Assuming what is above I can understand that a class I create for example class Pessoa :

    public class Pessoa
    {
       private string Nome {get; set;}
    
       public Pessoa()
       {
          this.Nome = "";
       }
    }
    

    This Pessoa class is a data type like string , int , char , or double ? Or can not a class be considered a data type?

        
    asked by anonymous 17.02.2016 / 01:04

    1 answer

    5

    Yes, a class is a data type. In C # there is a clear definition on this. The class is one of the possible types. The others are structures ( struct ), delegates ( delegate ), which can be expressed in lambda ), enumerations ( enum ), and interfaces ( interface ) .

    The word type is used generically to classify all these forms of data structures from the simplest to the most complex. Each of these different forms of quoted structures have their own characteristics, but all are statements of how an object should be formed.

    Then Pessoa before being a class, is a type. It has languages that do not have explicit syntax specific to each form and calls everything from type .

    If you use the typeof operator in Pessoa you will get an obvious type, right? So it's a type.

        
    17.02.2016 / 01:14