(103 Pepar) Priyesh Padiya
(103 Pepar) Priyesh Padiya
(103 Pepar) Priyesh Padiya
A SEM-3
October/November-2016
C++ & Object Oriented Program
One mark[I.M.P Questions] (1M)
Encapsulation.
Abstraction.
Inheritance.
Polymorphism.
#include <iostream.h>
class Base
{
public:
virtual void show()
{
Cout<<”In Base \n”;
}
};
class Derived : public Base
{
public:
void show()
{
cout<<”Inderived \n”;
}
};
int main()
{
Base * b =new Derived;
b-> show (); // RUN-TIME POLYMORPHISM
return 0;
}
Ans. Inderived
}
};
int main(void) {
Addition obj; // Object is created
cout<<obj.ADD(128, 15)<<endl; //first method is called
obj.ADD(); // second method is called
return 0;
}
Output: 143