Operator overloading: –

Operator overloading: - It’s a technique to overload the operator when applied on objects. Whenever the operator will be applied on objects then immediately compiler searches operator function. Operator function: - It is a function were the operator will be defined with operator keyword. Inside this function operator will be applied over member variables. Operator... Continue Reading →

Advertisements

191. Write a program to demonstrate multiple inheritance?

#include<iostream.h> #include<conio.h> class base1 { public:                 int b1; }; class base2 { public:                 int b2; }; class base3 { protected:                 int b3; }; class child:public base1,protected base2,private base3 {                 int c; public:                 void get()                                 {                                 b1=10;                                 b2=20;                                 b3=30;                                 c=40;                                 }                 void display()                                ... Continue Reading →

190. Write a program to access private member of base class indirectly by derived class of member function?

#include<iostream.h> #include<conio.h> class base {                 int i; public:                 void show()                                 {                                 i=10;                                 cout<<"I = "<<i<<endl;                                 } }; class derived:private base { private:                 int j; public:                 derived()                                 {                                 j=20;                                 }                 void display()                                 {                                 show();                                 cout<<"J = "<<j<<endl;                                 } }; void... Continue Reading →

189. Write a program to access the private members of base class indirectly by derived class? (By using base class constructor or public member function of base class, we can achieve above requirement)

#include<iostream.h> #include<conio.h> class base {                 int i; public:                 base()                                 {                                 i=10;                                 }                 void show()                                 {                                 cout<<"I = "<<i<<endl;                                 } }; class derived:private base { private:                 int j; public:                 derived()                                 {                                 j=20;                                 }                 void display()                                 {                                 show();                                 cout<<"J... Continue Reading →

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: