OBJECT ORIENTED PROGRAMMING:-
----------------------------------------------------------------------------
Object oriented Programming is defined as an approach that provides a way of modularizing programs by creating partitioned memory area for both data and functions that can be used as a template for creating copies of such modules on demand. Wriring object oriented programs involves creating classes, creating objcets from those
classes , and creating applications, which are standalone executable programs that used those objects.
After being created, classes can be reused over and over again to develop new programs. Thinking in an object oriented manner involves envisioning program components as objects that belongs to classes and are similar to concrete objects in the real world; then, you can manipulate the objects and have them interrelate with each other to achieve as a desired result.
BASIC CONCEPT OF OOPs:-
-------------------------------------
When you define a class, you declare that the data that it contains and the code that operates of that data. Data is contained in instance variables define by the class known as data members, and code is contained in functions known as member functions. The code and data that constitute a class are called members of the class.
Wrapping up of data and functions into a single unit.
Encapsulation is a programming machenism that binds together code and the data it manipulates, and that keeps both safe from outside interference and missuse. C++'s basic unit of encapsulation is the class .
Within a class, code or a data or both may be to private to that or public. Private code or data cannot be accessed by a piece of the program that exists outside the object.
The user need to know external interfaces only to make use of an object. The inner details of the object are hidden which makes them abstract. The technique of hiding internal details in an object is called data abstraction.
In general, the process of inheritance begins with the definition of a base class, The base class defines all qualities that will be common to any derived class. In OOPs, the concept of inheritance provides the idea of reuseability. In essence, the base class represents the most general discription of a set traits. The derived class inherits those general traits and adds properties that are specific to that class.
Syntax:
Polymorphism (from the greek, meaning "many forms") is a feature that allows one interface to be used for a general class of actions. The specific action is determined by the exact nature of the situation.
The concept of polymorphism is often expressed by the phrase "one interface, multiple methods." This helps reduce complexity by allowing the same interface to be used to specify a general class of action. It is compiler job to select the specific action as it applies to each situation.
----------------------------------------------------------------------------
Object oriented Programming is defined as an approach that provides a way of modularizing programs by creating partitioned memory area for both data and functions that can be used as a template for creating copies of such modules on demand. Wriring object oriented programs involves creating classes, creating objcets from those
classes , and creating applications, which are standalone executable programs that used those objects.
After being created, classes can be reused over and over again to develop new programs. Thinking in an object oriented manner involves envisioning program components as objects that belongs to classes and are similar to concrete objects in the real world; then, you can manipulate the objects and have them interrelate with each other to achieve as a desired result.
BASIC CONCEPT OF OOPs:-
-------------------------------------
Class:-
A class is a user defined data type. A class is a logical abstraction. It is a template that defines the form of an object. A class specifies both code and data. It is not until an object of that class has been created that a physical representation of that class exist in mempry.When you define a class, you declare that the data that it contains and the code that operates of that data. Data is contained in instance variables define by the class known as data members, and code is contained in functions known as member functions. The code and data that constitute a class are called members of the class.
Object:-
An object is an identifiable entity with specific characteristics and behavior. An object is said to be an instance of a class. Defining an object is similar to defining a variable of any datatype. Space is set aside for it in memory.
Encapsulation:-
Encapsulation is a programming machenism that binds together code and the data it manipulates, and that keeps both safe from outside interference and missuse. C++'s basic unit of encapsulation is the class .
Within a class, code or a data or both may be to private to that or public. Private code or data cannot be accessed by a piece of the program that exists outside the object.
Data Abstraction:-
An object oriented programming, each object will have external interfaces through which it can be made use of. There is no need to look into its inner details. The object itself may be made of many smaller objects again with proper interfaces.The user need to know external interfaces only to make use of an object. The inner details of the object are hidden which makes them abstract. The technique of hiding internal details in an object is called data abstraction.
Inheritance:-
Inheritance is an mechanism by which one class inherit the properties of another. It allows a hierarchy of classes to be build, moving from the most general to the most specific. When one class is inherited by another, the class that is inherited is called the base classes. The inheriting class is called the derived class.In general, the process of inheritance begins with the definition of a base class, The base class defines all qualities that will be common to any derived class. In OOPs, the concept of inheritance provides the idea of reuseability. In essence, the base class represents the most general discription of a set traits. The derived class inherits those general traits and adds properties that are specific to that class.
Syntax:
class derived-class extends base-class
{
//methods and fields
}
Polymorphism:-
The concept of polymorphism is often expressed by the phrase "one interface, multiple methods." This helps reduce complexity by allowing the same interface to be used to specify a general class of action. It is compiler job to select the specific action as it applies to each situation.
POLYMORPHISM
* Compile time Polymorphism.
* Runtime polymorphism.
* Function Overloading.
* Operator Overloading.
* Virtual Functions.
In Compile time polymorphism, the compiler is able to select the appropriate function for a particular call at compile time. In C++, it is possible to use one function name for many different purposes. This type of polymorphism is called function overloading. Polymorphism can also applied to operators. In that case, it is called operator overloading.
In run time polymorphism, the compiler selects the appropriate function for a particular call while the program is running. C++ supports a mechanism known as a virtual functions to achieve run time polymorphism .




0 Comments