Class (élmu komputer)
From Wikipedia, the free encyclopedia
Dina object-oriented programming (OOP), classes digunakeun keur ngelompokkeun variabel jeung fungsi nu patali. Class ngébréhkeun kumpulan variabel instance nu diéekapsulasi sarta méthode (fungsi), mungkin ogé ku jalan nerapkeun tipe éta babarengan jeung fungsi nu ngawangun nu bisa digunakeun keur nyieun objék class.
Artikel ieu keur dikeureuyeuh, ditarjamahkeun tina basa Inggris. Bantuanna didagoan pikeun narjamahkeun. |
Class mangrupa pakét kohésif nu eusina jenis husus métadata compile-time. Dina kelas aya aturan-aturan nu ngajelaskeun kalakuan objects; Objek-objek ieu ngacu ka "instance" ti kelas eta. A class specifies the structure of data which éach instance contains as well as the methods (functions) which manipulate the data of the object and perform tasks; such methods are sometimes described as "behavior". A method is a function with a special property that it has access to data stored in an object. A class is the most specific type of an object in relation to a specific layer. A class may also have a representation (metaobject) at run-time, which provides run-time support for manipulating the class-related metadata.
Instances of a class will have certain aspects (aka: féatures, attributes or properties) in common. A class 'Person' for example would describe the properties common to all instances of the 'Person' class. One of the benefits of programming with classes is that all instances of a particular class will follow the defined behaviour of the class they instantiate. éach person is generally alike; but varies in such properties as "height" and "weight". The class would list types of such instance variables; and also define, via methods, the actions which humans can perform: "run", "jump", "sleep", "throw object", etc.