EXPERIMENT 4:Program to Understand Operator Overloading Concept in C++ EXP: write a program in c++ to Add to Complex no using operator overloading. #include<iostream> #include<string.h> using namespace std; class complex { int real,img; public: input() { cout<<“\nEnter Real part:-“; cin>>real; cout<<“Enter imaginary part:-“; cin>>img; } display() {cout<<endl<<real<<“+”<<img<<“i”; } complex operator-(complex t) { complex temp; temp.real=real+t.real; temp.img=img+t.img; return temp; } }; int main() { […]
Category Archives: Object Oriented Language LAB
EXPERIMENT 3: oops lab
EXPERIMENT 3: Program to Find greatest no using Inheritance . INHERITANCE: Inheritance is a process of creating new class from existing classes. New class inherit some of the properties and behavior of the existing class.An exixting class That is “parent” of New classis called base class. EXP:Write a program in c++ single level inheritance #include<iostream> using namespace std; class A{ protected: int x,y,z; input() { […]
EXPERIMENT 2: oops lab
EXPERIMENT 2: Program to Understand constructor and destructor in C++ Constructor:A constructor is kind of member function that initializes an instance of its class .A constructor has the same name as the class and no return values. Download OOPs LAB in pdf: click here for download Destructor:”Destructor is inverse of constructor function.they are called when object are destroyed.Designate a function as a class detructor by […]
Object Oriented Programming(OOPs) LAB 1
Programming Lab: Object Oriented Language (OOPs) AKU,PATNA LIST OF EXPERIMENT Program to Understand class and object in C++ Program to Understand constructor and destructor in C++ Program to Understand Inheritance properties in C++ Program to Understand Operator Overloading Concept in C++ Program to Understand Function Overloading Concept in C++ Download in pdf Oops LAB click here EXPERIMENT NO 1: Program to Understand class and object […]