Студопедия
Случайная страница | ТОМ-1 | ТОМ-2 | ТОМ-3
АрхитектураБиологияГеографияДругоеИностранные языки
ИнформатикаИсторияКультураЛитератураМатематика
МедицинаМеханикаОбразованиеОхрана трудаПедагогика
ПолитикаПравоПрограммированиеПсихологияРелигия
СоциологияСпортСтроительствоФизикаФилософия
ФинансыХимияЭкологияЭкономикаЭлектроника

Object oriented programming

Creation and using one-dimensional and multi-dimensional arrays in the programming language Java. | Access labels | Classification of data types in the programming language Java. | Floating-point numbers | Generics in the programming language Java. | Continue Statement | Declaring Pointers |


Читайте также:
  1. Aims and Objectives
  2. Algorithms and programming languages
  3. An indefinite object
  4. Anonymous object creation expressions
  5. B) Complex Object (Objective Infinitive Construction)
  6. Channels switch soap operas commercials objective
  7. Classes and objects

In object oriented programming, the data and related functions are bundled together into an "object". Ideally, the data inside an object can only be manipulated by calling the object's functions. This means that your data is locked away inside your objects and your functions provide the only means of doing something with that data. In a well designed object oriented system objects never access shared or global data, they are only permitted to use the data they have, or data they are given.

 

 

3) The basic paradigms of object-oriented programming: encapsulation, polymorphism and inheritance.

Encapsulation

Encapsulation The act of placing data and the operations that perform on that data in the same class. The class then becomes the 'capsule' or container for the data and operations.

The data held within each object at runtime cannot remain in memory for ever, so it is written out to a persistent data store (a database) with a separate table for each entity. There are only four basic operations which can be performed on a database table (Create, Read, Update, Delete) so I shall start by creating a method for each one.

· The class constructor identifies the physical characteristics of this database table, that which makes it unique from all other database tables. The contents of the class constructor are performed automatically when the class is instantiated into an object.

· All the table data is held in a single array of fields rather than a separate variable for each field. For a detailed explanation as to why I choose this method please read

· There are actually many more methods than the four mentioned, but these are enough to begin with.

Each of these classes therefore acts as a 'capsule' which contains both the data for an entity and the operations which can be performed upon that data. This is 'encapsulation'.

Inheritance

Inheritance The reuse of base classes (superclasses) to form derived classes (subclasses). Methods and properties defined in the superclass are automatically shared by any subclass.

Inheritance is a mechanism for

-building class types from existing class types

-defining new class types to be a |specialization|augmentation| of existing types

Polymorphism

Polymorphism Same interface, different implementation. The ability to substitute one class for another. This means that different classes may contain the same method names, but the result which is returned by each method will be different as the code behind each method (the implementation) is different in each class

Polymorphism can only be employed where the same method names exist in several classes. The code within the method may be inherited from a parent class, or it may be totally different. This means that the same method can be used on different objects, but the results will be different.

 

 

4) Types of inheritance in C++.

Inheritance:- Inheritance means

using the Pre-defined Code This is very Main Feature of OOP With the advantage of Inheritance we can use any code that is previously created. With the help of inheritance we uses the code that is previously defined but always Remember, We are only using that code but not changing that code. With the Advent of inheritance we are able to use pre-defined code and also able to add new code. All the pre-defined code is reside into the form of classes if we want to use that code then we have to inherit or extend that class.

1. Single Inheritance

2. Multilevel Inheritance

3. Multiple Inheritance

4. Hierarchical Inheritance

5. Hybrid Inheritance

In Inheritance Upper Class whose code we are actually inheriting is known as the Base or Super Class and Class which uses the Code are known as Derived or Sub Class.

1) In Single Inheritance there is only one Super Class and Only one Sub Class Means they have one to one Communication between them

 

2) In Multilevel Inheritance a Derived class can also inherited by another class Means in this Whena Derived Class again will be inherited by another Class then it creates a Multiple Levels.

 

3) Multiple Inheritances is that in which a Class inherits the features from two Base Classes When a Derived Class takes Features from two Base Classes.

 

 

4) Hierarchical Inheritance is that in which a Base Class has Many Sub Classes or When a Base Class is used or inherited by many Sub Classes.

 

 

5) Hybrid Inheritance: - This is a Mixture of two or More Inheritance and in this Inheritance a Code May Contains two or Three types of inheritance in Single Code.

 

5) Functions in the programming language C++.

Function is a group of operators at which there is a name.


Дата добавления: 2015-11-16; просмотров: 66 | Нарушение авторских прав


<== предыдущая страница | следующая страница ==>
Procedural programming| The return Statement

mybiblioteka.su - 2015-2024 год. (0.006 сек.)