Wednesday, May 28, 2014
Function overloading - it is a feature of c++ that allows us to create multiple functions(many functions) under the same name but the only thing is that they want to have different parameters
#include<iostream>
using namespace std;
void print (int x)
{
cout<<"the integer no is"<<x;
}
void print (float x)
{
cout<<" the float number is "<<x;
}
int main()
{
int a;
float b;
a=45;
b=5.55;
print(a);
print(b);
...
Tuesday, September 17, 2013
Wednesday, September 11, 2013
Pointer
C++ Memory Map
Once a program is compiled, C++ creates four logically distinct regions of memory:Code Area : Area to hold the compiled program codeData Area : Area to hold global variablesStack Area : Area to hold the return address of function calls, argument passed to the functions, local variables for functions and the current state of the CPU.Heap : Area from which the memory is dynamically allocated to the program.
Accessing...
Tuesday, September 10, 2013
Basic Operation On Text File In C++
Program to write in a text file
#include<fstream.h>int main(){ ofstream fout; fout.open("out.txt"); char str[300]="Time is a great teacher but unfortunately it kills all its pupils. Berlioz"; fout<<str; fout.close(); return 0;}
Program to read from text file and display it
#include<fstream.h>#include<conio.h>int main(){ ...
Data File Handling In C++
File. The information / data stored under a specific name on a storage device, is called a file.
Stream. It refers to a sequence of bytes.
Text file. It is a file that stores information in ASCII characters. In text files, each line of text is terminated with a special character known as EOL (End of Line) character or delimiter character. When this EOL character is read or written, certain internal translations take place.
Binary file. It is a file that contains information in the same format...

Inheritance
Inheritance:It is the capability of one class to inherit properties from another class.
Base Class: It is the class whose properties are inherited by another class. It is also called Super Class.
Derived Class:It is the class that inherit properties from base class(es).It is also called Sub Class.
Forms Of Inheritance
Single Inheritance: It is the inheritance hierarchy wherein one derived class inherits from one base...
Constructor and Destructor
Constructor
It is a member function having same name as it’s class and which is used to initialize the objects of that class type with a legel initial value. Constructor is automatically called when object is created.
Types of Constructor
Default Constructor-: A constructor that accepts no parameters is known as default constructor. If no constructor is defined then the compiler supplies a default constructor.
student :: student(){ rollno=0; marks=0.0; }
Parameterized...
Monday, September 9, 2013
Class & Objects
The mechanism that allows you to combine data and the function in a single unit is called a class. Once a class is defined, you can declare variables of that type. A class variable is called object or instance. In other words, a class would be the data type, and an object would be the variable. Classes are generally declared using the keyword class, with the following format:
class class_name { private: members1; protected: members2; public: members3;};
Where...
Subscribe to:
Posts (Atom)