Showing posts with label India. Show all posts
Showing posts with label India. Show all posts

Class Constructor and Destructor for this Class

 #include<iostream>

using namespace std;

class Student

{

string name;

public:

Student(){

    name = "Vaibhav Yadav";

    cout<<"Constructor of Student Class has been Called"<<endl;

    cout<<"Student Name is: "<<name<<endl;

}

~Student(){

    cout<<"---Destructor Of Student Class has been called---"<<endl;

    cout<<"---Memory for 'obj name' has been deallocated and memory has been released---"<<endl;

}

};


main()

{

Student stu;

return 0;

}


Operator Overloading in C++

#include<iostream> using namespace std; class Complex { private: int real, imag; public: Complex(int r = 0, int i = 0){       re...