know yourselves. information, computer, 7 wonders, various.

Wednesday, November 8, 2017

C++ programming language part- 62 Virtual function with dynamic polymorphism


Virtual function with dynamic polymorphism

Program 45_2
//virtual class.demo
            class furniture              //class defined
            {private:
              char color[10];
              int h,w;
              public:
              virtual void data_in()
               { cout<<"Type color,width & height \t";
                  cin>>color>>w>>h; }
              virtual void data_out()
               { cout<
             virtual void massage()
             { cout<<"This result from base class"<
              };
            class chair:public furniture
            { private:
               int leg_no;                              
               public:
               void data_in()      //member function
             {furniture::data_in();        // Scope Resolution Operator
               cout<<"Type number of legs\t";
               cin>>leg_no; }
              void data_out() //member function
             {furniture::data_out();       // Scope Resolution Operator
               cout<<" Number of legs are "<
             void massage()
             { cout<<" This result from derived class "<
              };
            void main()
            {                                  //furniture X;
             furniture *f;
                                                //chair Y; 
             f=new furniture;
             f->data_in();
             f->data_out();
              f->massage();
             f=new chair;
             f->data_in();
             f->data_out();

              f->massage();      }


Part- 86 assign the content of twostring


জ্ঞানকোষ প্রকাশনী
৩৮/২-ক, বাংলাবাজার (২য় তলা), ঢাকা।
       ফোনঃ ৭১১৮৪৪৩, ৮১১২৪৪১, ৮৬২৩২৫১.         
                                                     
কলকাতায় পরিবেশক/প্রাপ্তিস্থান
রিতা ইন্টারন্যাশনাল
৩৬, পি.এন. ব্যানার্জি রোড, কলকাতা
ফোনঃ ২৫১৩৮৩৫৯, ৯৮৩০৪৩৯৬৭৯, +৯১৯৮৩০৪৩৯৬৭৯