Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
OOP
• It is a high level programming language
• It is based on objects and deals with object manipulation. e,g
Java ,C++
Object
It is an instant of class that defines the real entity in detail.
OR
It is a layout(pattern) that reflects (defines) the original entity in detail.
Note:- An object have the same relationship with the class as that of variable may
have with primitive data type.
Entity
It is the name property of a Object/Event/Person. There are two type of entity.
• Physical
• Logical
Physical Entity
These entities are tangible in nature. e,g. (a)Person (b)Place (c)object
Logical Entity
These entities are intangible in nature. e,g. Event
Object Manipulation
If various operations/functions/methods are applied on objects, that is named
as object manipulation.
C++ Data Types
Basic/ Default / Primitive data types (Used in structural
programming )
User Defined data types (Used in OOP)
Basic/ Default / Primitive Data Types
These are the data types that are available by default to every
user and he/she can use it by following standard rules
User Defined Data Types
These are the data types that deal with the real time objects.
Example : Classes , Structures
Primitive Data Varibles Class Object
Types
Int, float x, y User Defined L1
Char etc.. a,b,c Data Type Vc
etc.. e,g : Library S1 etc..
gcuf etc..
CLASS
It is a template (Layout, blue print) that generates numberless real time
objects.
Class interface/class specification+ class interface/class definition
Technical Definition
Class=Variable (Objects) +Object manipulation
OR
Class=Variable (Objects) +procedures/methods/functions
Data Items Or Data Members
Components or constituents of class
OR
These are the data members (Variables) of the class, that
defines the properties/characteristics of the class declared.
These are considered as private however not necessary condition.
Note : By default the status of data items is private in the class.
Member Functions
These are the methods/procedures/operations that are applied
on the data (i,e data items) for obtaining the desired
results/objectives.
Note : In general the status of data items is public in the class
however not necessary condition.
Note : If we never write any thing inside the class every thing will
be private.
Data_item(n);
public:
member_function(1);
member_function(n);
};
Access Specifier
These are the keywords/reserved words ,acts as indicator for
the compiler (included by the programmer inside the class interface)
according to which the properties of data items as well as member
function are defined.
(OR)
These are the Keywords that provide the accessibility for the
user/programmer being included inside the class interface.
Syntax
public:--------(1)
private:-------(2)
protected:----(3)
Access Class interface Implementation Main (Main of
Specifier (Inside the (Outside the the program
class) class)
Public
Private
Protected
Public
It is such a specifier,if it is included in a class interface every
element written afterwards should contain following features:
//for input from the user
void get_data(int x,float a, char s)
{
roll_no=x;
age=a;
sex=s;
}
Features of class
• User defines data type.
• Declaration: The Keyword of ‘class’ is used for
declaration.
• Members : It might contain of data items or member
functions or both
• Default Status: By default data items are private:
Use Of Class
It is used in Real time for solving any real world problem
Destructor:-
These are the special member functions that are used to de
allocate already memory allocated to various objects
Properties/principle/features/constituents
o Destructors should have same name as that of class name
similar to the constructor
o Destructors have no return type not even “void”.
o These cannot be overloaded
o It should be declared public necessarily
o These functions cannot be called explicitly by the
programmer
o It will be called automaticall.
o
Memory Concept In Classes
There are mainly two types of memory in class
• Static memory
• Dynamic memory
•
Static memory(static binding, compile binding, early
binding)
If the memory allocation is finalize at the compile time of a
program ,it is called static binding.
http://www.azhar.net.ms
Email- stylishguy1987@gmail.com