Object-oriented programming (oop) is a programming paradigm that represents the concept of “object” that have data fields (attributes that describe the object) and associated procedures known as methods. An object can be considered a “thing” that can perform a set of related activities. The set of activities that the object performs defines the object’s behaviour. […]
C++
Vector Addition and Subtraction
This is the solution for 2010 fall 4(b), 2007 Spring 4(b), 2010 Spring 3(b OR) PU BCA #include<iostream> using namespace std; class vector { float x;//real part float y;//imaginary part public: vector(){}//constuuctor 1 vector(float i,float j) { x=i; y=j; } vector operator+(vector); vector operator-(vector); void display(void); void display2(void); }; vector vector::operator+(vector c) { vector temp; […]
Virtual function and Polymorphism: C++
A member of a class that can be redefined in its derived classes is known as a virtual member. In order to declare a member of a class as virtual, we must precede its declaration with the keyword virtual. When a function is made virtual, C++ determines which function to be used at runtime based […]



