Brief History

Object-oriented programming (OOP) is a computer science term used to characterize a programming language that began development in the 1960’s. It describes the methodology of using objects as the foundation for computation. By the 1980’s, OOP rose to prominence as the programming language of choice, exemplified by the success of C++. Currently, OOPs such as Java, J2EE, C++, C#, Visual Basic.NET, Python and JavaScript are popular OOP programming languages.

Concept of OOP
OOP is widely accepted as being far more flexible than other computer programming languages. OOPs use three basic concepts as the fundamentals for the programming language: classes, objects and methods. Additionally, Inheritance, Abstraction, Polymorphism, Message Passing are also significant concepts within object-oriented programming languages.

Designed By Sayantan Basu

1

Designed By Sayantan Basu 2 . An object stores its state in fields (variables in some programming languages) and exposes its behavior through methods (functions in some programming languages). Bicycles also have state (current gear. Look around right now and you'll find many examples of real-world objects: your dog. current pedal cadence. your television set. breed. your bicycle. hungry) and behavior (barking. Software objects are conceptually similar to real-world objects: they too consist of state and related behavior. everything is considered as an object. In an objectoriented environment. color. applying brakes). Real-world objects share two characteristics: They all have state and behavior. changing pedal cadence.Objects are key to understanding object-oriented technology. current speed) and behavior (changing gear. fetching. your desk. Dogs have state (name. wagging tail).

including its characteristics (attributes. The instance is the actual object created at run-time.A class is a template for an object. A user-defined datatype that contains variables. fields or properties) and the what it can do (behaviors. methods. A class defines abstract characteristics of an object. Designed By Sayantan Basu 3 . properties of an object. One might say that a class is a blueprint that describes the nature of object. operations or features).

This binds data and operations tightly together and separates them from external access that may corrupt them intentionally or unintentionally. Designed By Sayantan Basu 4 .Encapsulation provides the mechanism for hiding information from unwanted outside access and attaching that information to only methods that need access to it. There are mainly three types of access modifiers : Private – Private keyword gives access to data to only member functions of the class. Public – Any method from outside or inside the class can access this type of data. Encapsulation is achieved by declaring variables with access modifiers in a class. Protected – A next level of accessibility is provided by the Protected keyword which gives the derived classes the access to the member variables of the base class – a variable declared as Protected can at most be accessed by the derived classes of the class.

An abstract class is a parent class that allows inheritance but can never be instantiated. An abstraction represents the common pattern and provides a means for specifying which variation to use. Abstract classes contain one or more abstract methods that do not have implementation. Also we can say abstraction refers to the act of representing essential features without including the background details or explanations.Abstraction is the process of identifying common patterns that have systematic variations. Abstract classes allow specialization of inherited classes. Designed By Sayantan Basu 5 .

Mountain bikes. Different kinds of objects often have a certain amount in common with each other. This type of relationship is called child-Parent or is-a relationship. which inherit attributes and behaviors from their parent classes. Yet each also defines additional features that make them different. current gear). In this example. and TandemBike. RoadBike. road bikes. and tandem bikes. Bicycle now becomes the superclass of MountainBike. current pedal cadence. for example. "Subclasses" are more specialized versions of a class. and can introduce their own. all share the characteristics of bicycles (current speed. Object-oriented programming allows classes to inherit commonly used state and behavior from other classes. Designed By Sayantan Basu 6 .Inheritance is a process in which a class inherits all the state and behavior of another class.

Polymorphism is a Latin word which describes 'poly' means many 'morphs' means forms. Polymorphism in object-oriented programming is the ability of objects belonging to different data types to respond to calls of methods of the same name. Designed By Sayantan Basu 7 . each one according to an appropriate type-specific behavior.

Static Methods Method associated with a type rather than an instance of the type. you call the method as UtilityClass. Static Class A static class is basically the same as a non-static class. i. the storage allocated becomes permanent for the duration of the program. if you have a static class that is named UtilityClass that has a public method named Method A. Designed By Sayantan Basu 8 . you access the members of a static class by using the class name itself. however. the value of a static variable in a function is retained between repeated function calls to the same function. Thus. Because there is no instance variable. it is local to the block in which it is defined. but there is one difference : a static class cannot be instantiated.MethodA().Static Variable Static variables continue to exist even after the block in which they are defined terminates.e. Static methods are accessible via the type name without instantiation. you cannot use the new keyword to create a variable of the class type. The scope of static variables is identical to that of normal variables. For example. In other words.

Sign up to vote on this title
UsefulNot useful