<- People Behind Informatics


All 0-9 A B C D E F G H I J K L M N O P Q R S T U V W XY Z




 
Class Concept
Classes serve as templates from which objects can be created. They are record-structured templates whose instantiation creates objects whose interfaces are record-structured. The class point has precisely the same instance variables and operations as the object point, but their interpretation is different. Whereas the instance variables of a point object represent actual variables, class instance variables are potential, being instantiated only when an object is created. Instances of a class can be created by a makeinstance operation (often called new), which creates a copy of the class instance variables that may be acted on by the class operations: p:=make-instance point;--create a new instance of the class point, call it p Instance variables in class definitions may be initialized as part of object creation: p1:=make-instance point (0,0) ; -- create point initialized to (0,0),call it p1 p2:=make-instance point (1, 1) ; -- create point initialized to (1,1),call it p2 The two points p1, p2 each have private copies of the class instance variables and share the operations specified in the class definition. When an object receives a message to execute a method, it looks for the method in its class definition. We may think of a class as specifying a behavior common to all objects of the class. The instance variables specify a data structure (for realizing the behavior. The public operations of a class determine its behavior, while the private instance variables determine its structure. [Source: Encyclopedia of Computer Science, Fourth Edition, Anthony Ralston, Edwin D. Reilly, David Hemmendinger]
 

 

<- People Behind Informatics


Home  |  Top  |  Search  |  Gallery  | Glossary  | Sitemap  |  Making Of  |  Help