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


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


C++ programming language part- 63 Streams


Streams

A stream is a sourse or destination for collection of character. Streams are two types:  Output streams, allow you to write or store characters and Input streams, allow you to read or fetch characters.
The class  ios is a virtual base class for the istream (Input stream) and ostream (Output stream). The isstream (Input and Output stream) is a class with multiple inheritance from both istream and ostream. The header file contains all of the classes.  

User-define streams

User-define streams are in the form of files. A file is linked to a stream. before a file can be opened, a stream must be obtained.


Stream Classes hierarchies
 



 ifstream-derived from istream, used to file input(reading)
 ofstream-derived from ostream,used for file output (writing)
 fstrean- derived from io stream, used for both





File Input and Output with Integer

The following programs deal with file input and output with respect to using fundamentals and user-define data types. Objects called ofil and Ifil of class ofstream  are created and associated with a file named "int.txt"

Program 46-1
//steam.demo
            #include
             void main()
            {
            ofstream ofil("int.txt");            // object would be any name
            ofil<<12 o:p="">
            }                      // open this text file and watch information from notepad


Program 46_2
            //file output
            #include
            void main()
{ ifstream  ifil("int.txt");     //object would be any name
               int p,q,r;
               ifil>>p;          // like cin
               ifil>>q;
               ifil>>r;
               cout<
            // information from text file named int.txt

File Input and Output with String

Program 46_3
            #include
            void main()
            {
            ofstream nova_sfil("string.txt");
            nova_sfil<<" This is Nova System";
            }
            // open this text file and watch information


Program 46_4
            //file output
            #include
            void main()
            {
            ifstream  sfil("string.txt");     //object would be any name
            char cstr[30];                           // like cin
sfil>>cstr;
            cout<
            }

            // information from text file named int.txt


Part- 86 assign the content of twostring


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