File system: –

File system: - The fstream is a class in C++ that supports read from the file, create the file, write onto the file, open the file, close the file etc. Ofstream: - ofstream is a class which is used to write the text onto the file. Ifstream: - ifstream is a class which is used … Continue reading File system: –


Storage class: –

Storage class: - It is a class which is use to improve the efficiency of program. There are four types of storage class. Automatic (auto) Register (register) External (extern) Static (static) There are four parameters have been use for all four types of storage class. Lifetime Scope Initial value Memory Automatic storage class: - All … Continue reading Storage class: –

Exception handling: –

Exception handling: - It is a technique to handle the exception which is accord from a location of program and transfer the control of compiler to the exception handler routine (catch block). Exception: - It is a run time error which is found during execution of program (Not at compilation time) Ex: - #include<iostream.h> #include<conio.h> … Continue reading Exception handling: –

Template: –

Template: - It is a technique that allows a function or a class to work with different-different data types. Template data type inside function is used to process all kinds of data from different-different types. There are two types of template. (1) Class Template, (2) Function Template. Syntax of class template: - template <class T> … Continue reading Template: –

Virtual base class: –

Virtual base class: - The ambiguity problem with multipath inheritance is solved by making a base class as virtual. When we make a base class as virtual then compiler will avoid the duplication of members of base class into the child class. Function overriding: - It is only supported by inheritance. The member function from … Continue reading Virtual base class: –

Type of inheritance: –

Type of inheritance: - The following are types of inheritance. Single inheritance Multiple inheritance Multi-level inheritance Hybrid inheritance Hierarchical inheritance Multi-path inheritance Single inheritance: - When one derived class is derived from one base class then such type of inheritance is called as inheritance. Multiple Inheritance: - When one child class has more than one … Continue reading Type of inheritance: –

211. Write a program to demonstrate object slicing?

#include<iostream.h> #include<conio.h> class base { public:                 int x;                 base()                 {                                 x=10;                 } }; class derived:public base { public:                 int y;                 derived()                 {                                 x=30;                                 y=50;                 } }; void main() {                 clrscr();                 base b;                 derived d;                 cout<<"In Base Class X ="<<b.x<<endl;                 … Continue reading 211. Write a program to demonstrate object slicing?

210. Write a program to demonstrate external storage class?

TEST.H int i=9;  //Global Variable DEMO.CPP #include<iostream.h> #include<conio.h> #include"TEST.H" extern int i;         //External Variable void main() {                 clrscr();                 cout<<"External Variable : "<<i<<endl;                 getch(); }

209. Write a program to demonstrate overloading template function?

#include<iostream.h> #include<conio.h> template <class T> void display(T t) {                 cout<<"Inside Template Function = "<<t<<endl; } void display(int i) {                 cout<<"Inside Specific Function = "<<i<<endl; } void main() {                 clrscr();                 display('X');                 display(10);                 display('Z');                 display(10.5);                 getch(); }

208. Write a program to perform the operation using function template?

#include<iostream.h> #include<conio.h> template <class T> void display(T v) {                 cout<<"V = "<<v<<endl; } void main() {                 clrscr();                 int i=50;                 char c='Z';                 double d=3.71;                 display(i);                 display(c);                 display(d);                 getch(); }