Encapsulation is one of the four fundamental OOP concepts. It is the inclusion within a program object of all the resources needed for the object to properly function on its own - basically, the methods and the data. The object has its public interface and other objects adhere to these interface to use the object without having to be concerned with how the object internally implements it. The idea is "don't tell me how you do it; just do it".
OOP and OOD questions and answersBest answers to interview questions about OOP and OOD. OOP is a modern programming approach organized around "classes" and "objects".
Object composition in OOP refers to combining two or more different classes with purpose of creating new, more complex class. In case of composition, an object "owns" another object, rather than just use it, which means if main object will be destroyed, all internal objects should be destroyed as well. In case of aggregation, which is a closely related concept to composition, you can say an internal object is a part of the main object, but is still independent and can exists on its own.
Prototype-based programming is a style of object-oriented programming in which inheritance is implemented via process of cloning existing objects that serve as prototypes. Read more about prototype-based OOP here. In prototype-based languages objects inherit directly from other objects, in more classical class-based OOP languages inheritance is based around "parent-child" relationship between classes.
Prototype-based programming is a style of object-oriented programming in which inheritance is implemented via process of cloning existing objects that serve as prototypes. Read more about prototype-based OOP here. Class-based inheritance enables new classes to take on the properties and behavior of existing classes.
Abstraction is the process of removing unnecessary characteristics from something in order to reduce it to a set of essential, well defined characteristics. In object-oriented programming, abstraction is one of central principles, along with polymorphism, inheritance and encapsulation, closely tied with the last two.
Polymorphism is one of the four fundamental OOP principles. It is the ability to present the same interface for differing underlying types. In terms of .NET, for example, polymorphism means that at run time, objects of a subclass may be treated as objects of a superclass in places of their use, such as collections or method parameters. When this occurs, the object's actual type at run-time is no longer identical to its declared type. There are several kinds of polymorphism.
Object-oriented programming or OOP is programming model based on the concepts of "objects", which are data structures that contain data, in the form of fields, and code, in the form of methods. In addition, programmers can create relationships between objects. For example, objects can inherit data and methods from other objects. Program, designed with OOP approach, is maked of objects that interact with one another. Most popular languages have class-based OOP, meaning that objects are instances of classes, which typically also determines their type.
Object composition in OOP refers to combining two or more different classes with purpose of creating new, more complex class. Usually it looks like an object that contains another object. "Сontains" means object has reference to other one.
Prototype-based programming is a style of object-oriented programming in which inheritance is implemented via process of cloning existing objects that serve as prototypes. There are two methods of constructing new objects: object creation "from nothing" or through cloning an existing object.
Inheritance represents the relationship between two objects or two classes where one derives functionality from another and then extends it by adding new fields, properties or methods. It is one of the fundamental concepts of the object-oriented programming along with polymorphism, abstraction and encapsulation. Inheritance allows classes to inherit commonly used state and behavior from other classes, so it is one of the main tools of code reuse in OOP.