Introduction to Object Oriented Programming
Types of Programming Languages:
- Structure Oriented Programming Language:
The programming implementation flow depends on structures. That means you need to create the structures for each data entity. Those structure members can be created in the individual functions.
Ex: Pascal, C, C++ etc.
- Object Oriented Programming Languages:
The programming implementation flow depends on classes. In the main() method, you need to create the instances for the classes and access those methods. These instances are called "Objects".
Ex: C++, VC++, Java and all .NET languages.
The "OOP" is a new type of programming style, introduced in 1980‘s.
Basic Terminology in OOP Languages:
- Class:
A class describes about the logical structure of an object. That means it describes about the data to be stored in the in an object and also some operations, that are to be performed on that data. No memory will be allocated for the class. In other words, a class is used to classify the objects.
Syn:
class classname
{
//fields
//properties
//methods
}
- Field / Data Member:
A variable, declared inside of the class is called as "field" / "data member". The fields are used to store the data values.
- Property:
It‘s an extension to the field, which automatically performs the specified code, whenever its value is changed.
- Method / Member function:
It‘s also called as operation / member function. A method is nothing but a function, which is defined inside of the class. It is used to perform some process on the data members.
- Object:
It‘s an instance of the class. It‘s required because, no memory will be allocated for the class, so that
you can‘t store any data and you can‘t call any operation. It is similar to "structure variables", which is declared for the "structure". The actual memory will be allocated for the object, which includes with
all the data members. The object can access the members that are defined in the class.
No comments:
Post a Comment