PROGRAMACION ORIENTADA A OBJETOS C# PDF

C provides full support for object-oriented programming including encapsulation, inheritance, and polymorphism. Encapsulation means that a group of related properties, methods, and other members are treated as a single unit or object. La herencia describe la posibilidad de crear nuevas clases basadas en una clase existente. Inheritance describes the ability to create new classes based on an existing class. Polymorphism means that you can have multiple classes that can be used interchangeably, even though each class implements the same properties or methods in different ways. The terms class and object describe the type of objects, and the instances of classes, respectively.

Author:Bataxe Zulkiktilar
Country:Turkmenistan
Language:English (Spanish)
Genre:Health and Food
Published (Last):2 March 2004
Pages:163
PDF File Size:14.70 Mb
ePub File Size:14.67 Mb
ISBN:721-7-38368-960-8
Downloads:86914
Price:Free* [*Free Regsitration Required]
Uploader:JoJolar



C provides full support for object-oriented programming including encapsulation, inheritance, and polymorphism. Encapsulation means that a group of related properties, methods, and other members are treated as a single unit or object. La herencia describe la posibilidad de crear nuevas clases basadas en una clase existente. Inheritance describes the ability to create new classes based on an existing class.

Polymorphism means that you can have multiple classes that can be used interchangeably, even though each class implements the same properties or methods in different ways. The terms class and object describe the type of objects, and the instances of classes, respectively. So, the act of creating an object is called instantiation. Using the blueprint analogy, a class is a blueprint, and an object is a building made from that blueprint. For more information, see the articles on the class and struct keywords.

Each class can have different class members that include properties that describe class data, methods that define class behavior, and events that provide communication between different classes and objects. Fields and properties represent information that an object contains. Los campos se parecen a las variables ya que se pueden leer o establecer directamente, sujetos a los modificadores de acceso aplicables.

Fields are like variables because they can be read or set directly, subject to applicable access modifiers. Properties have get and set accessors, which provide more control on how values are set or returned.

C allows you either to create a private field for storing the property value or use auto-implemented properties that create this field automatically behind the scenes and provide the basic logic for the property procedures.

Most properties have methods or procedures to both set and get the property value. However, you can create read-only or write-only properties to restrict them from being modified or read.

In C , you can omit the get or set property method. However, auto-implemented properties cannot be write-only. Read-only auto-implemented properties can be set in constructors of the containing class. A method is an action that an object can perform.

A class can have several implementations, or overloads, of the same method that differ in the number of parameters or parameter types. In most cases you declare a method within a class definition. However, C also supports extension methods that allow you to add methods to an existing class outside the actual definition of the class. Constructors are class methods that are executed automatically when an object of a given type is created. Normalmente, los constructores inicializan los miembros de datos del nuevo objeto.

Constructors usually initialize the data members of the new object. Un constructor solo puede ejecutarse una vez cuando se crea una clase. A constructor can run only once when a class is created. Furthermore, the code in the constructor always runs before any other code in a class. However, you can create multiple constructor overloads in the same way as for any other method.

For more information, see Constructors. FinalizadoresFinalizers Los finalizadores se usan para destruir instancias de clases. Finalizers are used to destruct instances of classes. In the. NET Framework, the garbage collector automatically manages the allocation and release of memory for the managed objects in your application.

However, you may still need finalizers to clean up any unmanaged resources that your application creates. Solo puede haber un finalizador para una clase. There can be only one finalizers for a class. For more information about finalizers and garbage collection in the. EventsEvents Cuando ocurre algo interesante, los eventos habilitan una clase u objeto para notificarlo a otras clases u objetos. Events enable a class or object to notify other classes or objects when something of interest occurs.

The class that sends or raises the event is called the publisher and the classes that receive or handle the event are called subscribers. For more information about events, how they are raised and handled, see Events.

Para declarar un evento en una clase, use la palabra clave event. To declare an event in a class, use the event keyword. Para generar un evento, invoque al delegado de eventos. To raise an event, invoke the event delegate. Clases anidadasNested classes Una clase definida dentro de otra se denomina anidada.

A class defined within another class is called nested. De forma predeterminada, una clase anidada es privada. By default, the nested class is private. Nested Modificadores y niveles de accesoAccess modifiers and access levels Todas las clases y miembros de clase pueden especificar el nivel de acceso que proporcionan a otras clases mediante los modificadores de acceso. All classes and class members can specify what access level they provide to other classes by using access modifiers.

The type or member can be accessed by any other code in the same assembly or another assembly that references it.

TB1334FG PDF

ProgramaciĆ³n orientada a objetos

El programador debe pensar indistintamente en ambos conceptos, sin separar ni darle mayor importancia a alguno de ellos. Herencia Por ejemplo, herencia de la clase C a la clase D, es la facilidad mediante la cual la clase D hereda en ella cada uno de los atributos y operaciones de C, como si esos atributos y operaciones hubiesen sido definidos por la misma D. Objeto Instancia de una clase. Se corresponden con los objetos reales del mundo que nos rodea, o con objetos internos del sistema del programa.

GLASSLANDS HALO PDF

ProgramaciĆ³n orientada a objetos (POO)

.

Related Articles