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; […]

C++ Lists

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 […]