Pages

Gedung Pusat Administrasi

POLITEKNIK NEGERI MEDAN

COMPUTER ENGINEERING

POLITEKNIK NEGERI MEDAN

Pembukaan Kegiatan P2MB

POLITEKNIK NEGERI MEDAN

POLITEKNIK NEGERI MEDAN

BAJU COMPUTER ENGINEERING

POLITEKNIK NEGERI MEDAN

Wednesday, November 7, 2012

SUMMARY OCTOBER 18

SUMMARY OCTOBER 18
Inheritance: A class that is derived from another class is called a subclass (also a derived class, extended class, or child class). The class from which the subclass is derived is called a superclass (also a base class or a parent class).
Polimorphsm: the ability of an object to take on many forms. In programming languages polymorphism is the capability of an action or method to do different things based on the object that it is acting upon. This is the third basic principle of object oriented programming. The three types of polymorphism are: ad-hoc (overloading and overriding), parametric (generics) and dynamic method binding.
Extends : is used to carry out the reduction of a class.
Abstraction: Abstraction refers to the ability to make a class abstract in OOP. An abstract class is one that cannot be instantiated. All other functionality of the class still exists, and its fields, methods, and constructors are all accessed in the same manner. You just cannot create an instance of the abstract class.
Method Overloading: a function means that you have multiple functions with the same name, but different signatures. The signature of a function is its return type and number/types of parameters.
Method Overriding: a method in the child class having the same name, same number of parameters and the same access specifier as in it’s parent then we can say that we are doing method overriding.   
The example of Polimorphsm:    Bird myBird = null;
                                                                   myBird = new Bird (7);
                                                                   myBird.beak();
                                                                   System.out.println ("");
   
The example in constractor :     public Bird (int v)
                                                   {                                         
                                                                                                    super ();
                                                                                                    this.flyVelocity = v;
                                                          System.out.println("This Bird flyVelocity is " +flyVelocity);
                                                          }
               

Friday, October 5, 2012

OBJECT ORIENTED PROGRAMMING






From Addison Wesley – The Essence Of Object Oriented Programming With Java and UML


ü   Object Orientation is a significantly different way of thinking about solving problems and developing software solutions.
ü An Object-Oriented System is one that has been designed using abstraction with objects, encapsulated classes, communication via messages, object lifetime, class hierarchies, and polymorphism.
ü         An object represents an instance of a real or abstract thing.
ü   Encapsulation is enforced by having the definitions for attributes and methods inside a class definition.
ü   The attributes of  a class are defined by the declaration of  variables of  various types such as int or boolean.
ü     A Java class includes the definitions of  the methods used to implement the behaviors of  the class.
ü        The method definitions are integral parts of the class definition.
ü     A class is the definition of the attributes and methods needed to model a related group of objects.
ü  Classes can be organized into hierarchies. Association is a relationship between classes. Aggregation and composition represent whole/part relationships. Inheritance represents generalization/specialization.
ü   The interaction can be between objects of the same class, or objects of different classes. This interaction is handled  by sending messages (in Java, this is done by calling methods) to other objects to pass information or request action.
ü  Object Lifetime. The time an object exists - from its instantiation in its constructor until the object no longer exists and has been finalized by the Java garbage collector.
ü  Inheritance allows subclasses to selectively derive the properties of a superclass.
ü  Identity The characteristics or state of an object that allows it to be distinguished from other objects.
ü      Polymorphism is a characteristic of inheritance that ensures that instances of such subclasses behave correctly.
ü   Polymorphism goes hand in hand with inheritance, and means the right methods are used for individual objects in a derived class.
An understanding of how objects are created and implemented can make it easier to write good OO programs.
ü           There are four level visibility of methods.
ü Public Visibility. Public attributes and operations are visible to the whole world. Any other class can access the public items of a class.
ü Private Visibility. Private attributes and operations are visible only to members of the given class.
ü Protected Visibility. Protected attributes and operations are visible to the class and its subclasses.
ü  Friend Visibility. Friend attributes and operations are visible to a specified set of other classes. In Java, the package is used to define friend visibility. In C++, the friend specifier is used.
ü Just as any other specialized discipline, object-orientation has its own vocabulary.