You are on page 1of 4

Lec 1(Mon,12,12,2022)

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.

When we add data in files we using stream

TO save data we use stream.


Types
1-Standard input(int a,b) Note :<<insertion
2-Standard input (cin or cout) >>Extraction

#include<fstream> ]--->for file handling.

Cin for entering data.


Cout for Result.
Cerr for finding error without buffer.
Clog same but time taken.
IOS

ISTREAM OSTREAM

IFSTREAM IOSTREAM OFSTREAM

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)

Keyword(test.txt,cin or cout or f.stream)


Lec2(tuesday,13,12,2022)------>Lab

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

1-Single inheritance.(A type of inheritance in which a child class is derived form


single inheritance.)
2-Multiple inheritance.(A type of inheritance in which a child class is derived form
multiple 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
}

Imp->The accessability of derived class in public inheritance is


follow as:
1-The derived class can acess the Public member of parent class.
2-The derived class can acess the Protected member of parent class.
3-The derived class can’t acess the Private member of parent class.

Imp->The accessability of an object derived class in public


inheritance is follow as:
1-The object of derived class can access the Public member of parent class.
2-The object of derived class can’t access the Protected member of parent class.
3-The object of derived class can’t access the Private member of parent class.

2-Protected
In Protected inheritance the access status of parent class member in the
derived class is restricted.syntax is same as Public.

Imp->The accessability of derived class in Protected


inheritance is follow as:
1-As same as Public access specifier.

Imp->The accessability of an object derived class in public


inheritance is follow as:
1-The object of derived class can’t access the any specifier of parent class.

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.

The accessability of an object derived class in Private


inheritance is follow as:
Can’t acess member of Public,Private & Protected.

Topic: Multilevel inheritance:


A type of imheritance a class is derived from another derived class .In multilevel
inheritance the member of Parent class are inherited to the child class and the
member of child class are inherited in grand calss.
Parent class -->Child class -->GRAND Child class.

Syntax class A
{
Body
};
Class B : Public A
{
Body
}
Class C :Public B
{
Body
}

Acessing constructor of Parent class


Syntax

Class Parent
{
Public:
Parent()
{

}
};
Class class:Public Parent
{
Child () : parent()
{
Body
}
}

Lec6(Thursday-22-12-2022)

You might also like