Professional Documents
Culture Documents
Files handling
FILE:
Collection of related Data.
Advantage of File:
1-File can be stored lard=ge amount of data permenantely.
2-File can be update easily.
3-One file can be used by many programs for same input .input data via keyboard.
Type of files:
1-Text file:Source program can be stored by using txt file.
2-Binary file:Object program can be stored by using binary file.
ISTREAM OSTREAM
FSTREAM
Class of stream:
1-if stream -->cin:The stream use to read files.
2-of stream -->cout:The stream use to write on files.
3-F stream --file handing.This is used for both read/write.
Opening file:
Syntax
Open(file name,mode)
Lecture3(Thursday-dec-15-2022)
Inheritance
A technique that is use to reuse an existing class tobuild new class is known as
inheritance.
Class name()->(existing class)
{
Body
}
Class name()->(new class called derived/base/child class)
{
body
}
Advantage of of inhertance
1-It has a rusing ability.
2-It allow developer to to ruse existing code in many situations.
3-A class can be created once and use again and again to create many sub class.
4-Utilize or Save time and effort.
5-Increase program structure and reliability .
6-A superclass is already compiled and tested properly so this class can be used in a
new appplication without compiling it again.
Catagories of Inheritance
Lecture4(Friday-Dec-16-2022)
TYPE OF Inheritance
1-Public. 2-Protected 3-Private.
1-Public.
The Public member of parent class become member of derived class.
Syntax:
Class parent
{
Public;
Data member;
Functions;
}
Class child class childname&Public Parent name
{
Parent class data member & functios use in child class
}
2-Protected
In Protected inheritance the access status of parent class member in the
derived class is restricted.syntax is same as Public.
Lec5(19-Dec-2022)
Private inheritance
In private inheritance the acess status of parent class member in the derived
class is restricted.
Class child-name : private parent
{
body
}
The accessability of derived class in Private inheritance is
follow as:
The derived class can acess Public& protected member of the Parent class but acess
the member of private no of Parent class.
Syntax class A
{
Body
};
Class B : Public A
{
Body
}
Class C :Public B
{
Body
}
Class Parent
{
Public:
Parent()
{
}
};
Class class:Public Parent
{
Child () : parent()
{
Body
}
}
Lec6(Thursday-22-12-2022)