Category : multiple-inheritance

I used to write code like this: class SomeInterface { public: virtual void doThings() = 0; virtual void run() = 0; }; class OtherInterface { public: virtual void doStuff() = 0; virtual void run() = 0; }; class ConcreteClass : public SomeInterface, public OtherInterface { public: virtual void doThings() { … } virtual void doStuff() ..

Read more

i had one of these q asked in my test (the output). i searched a lot but unable to understand why #include <iostream> using namespace std; class building{ public: building() { cout<<"geek building"<<endl; } }; }; class house: public building{ public: int a=5; house(){ cout<<"geek house"<<endl; } house(string name){ new (this) house(); cout<<"geek house: string ..

Read more

i had one of these q asked in my test (the output). i searched a lot but unable to understand why #include <iostream> using namespace std; class building{ public: building() { cout<<"geek building"<<endl; } }; class house: public building{ public: house(){ cout<<"geek house"<<endl; } house(string name){ new (this) house(); cout<<"geek house: string constructor"<<endl; } }; ..

Read more

I was given an assignment and the question says implementation of the upper-triangular and lower-triangular matrix. Hence I made a class and solve it. Here is the code. using namespace std; class TriangularMartix { protected: int* array; int size; int arrsize; public: TriangularMartix(int size){ // constructor cout<<"i"; arrsize=size*(size+1)/2; this->size=size; array=new int [this->size]; } // ~TriangularMartix(){ ..

Read more