Posts

CPP External Oral Programs

//Implementation of construcor and destructour #include<iostream> using namespace std; class Test { public: Test() { cout<<"\n This line is constructed By Constructor"; } ~Test() { cout<<"\n Destructor Destruct line created by counstructor"; } }; main() { Test t,t1; return 0; } // 2.2 Parameterised constructor #include <iostream> using namespace std; class Wall {   private:     double length;     double height;   public:         Wall(double len, double hgt) {       length = len;       height = hgt;     }     double Area() {       return length * height;     } }; int main() {   Wall wall1(10.5, 8.6);   Wall wall2(8.5, 6.3);   cout << "Area of Wall 1: " << wall1.Area() << endl;   cout << "Area of Wall 2: " << wall2.Area();   return 0; } //3function overl...