Skip to main content

12th HSC free notes of c++ language theory part 3

 Object oriented programming

• Object oriented programming is an approach that provides a way of modularizing programs by creating partitioned memory area for both data and function that can be used as templates for creating copies of such modules on demand .
• In object oriented programming the program is designed around the data being operated upon rather than upon the operation themselves.
• OOP allows to decompose a problem into a number of entities called object and then build data and function around these entity.
• When program is executed the object interact by sending message to one another
• Each object contains data and code to manipulate the data .

Features of OOP :
• Program are divided into number of object.
• Data is hidden and cannot be accessed by external function
• Object may communicate with each other through function
• New data and function can be easily added wherever required.
Object :
• Object are the basic runtime entity in object oriented system .
• For e.g they may represent a person , a place , a bank.
• Programming problem is analyzed in term of object and the nature of communication between them .
• Program object should be chosen such that they match closely with the real world object .

Class :
• Class is way to bind a data and is associated functions together.
• The entire set of data and code of an object can be made an user define datatype with the help of class
• Infact an object is nothing but a variable whose datatype is class
• Once a class has been define user define any number of object belonging to that class
• Class is a collection of object of similar type.

What are friendly function? Give the characteristics of a friendly function .
 C++ allows the common function to be made friendly with more than one classes , thereby allowing the function to have access to the private data of class . Such a function need not be a member of any classes.
 Non-member function cannot have access to the private data of a class . However , there could be a situation where user would like two classes to share a particular function. At this situation friend function is used.
 The keyboard “ friend ” declare the function to be friendly with that class. This function is defined as a normal c++ function . The function definition does not use class – name , keyboard friend or scope resolution operator.
 A friend function has following characteristics :
(1) It is not in the scope of the class to which it has been declared as friend .
(2) since it is not in scope of the class, it cannot be called by using object of that class . It is called like a normal c++ function .
(3) It can be declared either in public or the private part of a class without affecting is meaning .
(4) Usually , it has the objects as arguments.
(5) It cannot access the member function directly and has to use an object name and dot operator with each member name .

Comments

Popular posts from this blog

Free notes of Biomolecules short revision part 1

Biomolecules Polysaccharide are not sweet in taste.               All monosaccharides are reducing sugar.         Monosaccharides are starting from carbon number 3.                                                                Starch contain amylose and amylopectin amylose contain bonding between c1 -c4 and amylopectin has c1-c6 bonding in their structure.                                                                 Monomers: a)Lactose : 1) beta -D galactose 2)beta - D glucose.                                   ...

Free notes of surface tension

  Surface tension.         Intermolecular forces:- The forces of attraction and repulsion between their molecules . These forces ,are called intermolecular . Their is to forces 1) cohesive force.  2) adhesive force. Cohesive force:- the force of attraction between 2 molecules of same substance called as cohesion. Adhesive force:- the force of attraction and repulsion between the two different substance like liquid and solid ,solid with gas etc. is called adhesion. Range of molecular forces:- The maximum distance between 2 molecules upto which intermolecular forces are effective (also called as short range forces). Distance (10 to the power -9). Sphere of influence :- an imaginary sphere drawn with given molecule as centre and radius equal to the molecular range . Surface film :- The layer of surface of liquid whose thickness is about equal to range of molecular attraction. Surface energy :- when a molecular is taken from the inside to the surface layer work...

Free notes of Biomolecules short revision part 2

  Biomolecules part 2. DNA has bases like adenine , gunine , cytosine , thymine.                                                  RNA has bases like adenine, gunine , cytosine , urasil.                                                        Adenine have hydrogen bond with thymine and cytosine have hydrogen bond with gunine.                                                                       D- fructose , D - manose ,D- glucose , form a same osazone product .                        ...