C++ Tutorials

C++ Program For Unary Operator Overloading 0

C++ Program For Unary Operator Overloading

Program 1 //Unary Operator overloading (- operator) #include<iostream> #define clrscr() system(“cls”) using namespace std; class Test { int a,b,c; public: Test(int a,int b,int c) { this->a=a; this->b=b; this->c=c; } void operator-(); void display(); };...

C++ Program For Method Overloading 0

C++ Program For Method Overloading

Program 1 // Program for method overloading #include<iostream> #define clrscr() system(“cls”) using namespace std; class Test { public: int add(int a,int b); int add(int a,int b ,int c); int add(int a,int b,int c,int d);...

C++ Program For Static Variables 0

C++ Program For Static Variables

Program 1 //Program of static variable #include<iostream> #define clrscr() system(“cls”) using namespace std; class Student { public: int rno,mno; static int ccode; static int count; Student(int rno,int mno) { this->rno=rno; this->mno=mno; count++; } void...

C++ Program For Copy Constructor 0

C++ Program For Copy Constructor

Program 1 // Program for copy constructor #include<iostream> #include<string.h> #define clrscr() system(“cls”) using namespace std; class Student { private: int rno; char name[50]; public: Student(int rno,char name[]) { this->rno=rno; strcpy(this->name,name); } Student() {} Student(Student...

C++ Program For Constructor Overloading 0

C++ Program For Constructor Overloading

Program 1 //Program by call by reference #include<iostream> #define clrscr() system(“cls”) using namespace std; class Test { int a,b,c,d; public: Test(int x,int y,int z) { cout<<“\nConstructor with 3 argument”; a=x; b=y; c=z; } Test(int...

C++ Program For Constructors 1

C++ Program For Constructors

Program 1 // Program for Cnstructor #include<iostream> #define clrscr() system(“cls”) using namespace std; class Test { int n; public: Test() { n=100; } void incr(); void display(); }; void Test::incr() { ++n; } void...