ACCESS SPECIFIERS

 #include<iostream.h>
     #include<conio.h>
     class  Demo
     {
      public:
      //member function
      void disp1()
      {
      cout<<"\n\tPublic Section";
      disp2();
      disp3();
      }
      private:
      void disp2()
      {
       cout<<"\n\tPrivate Section";
      }
      protected:
      void disp3()
      {
       cout<<"\n\tProtected Section";
      }
     };

      void main()
      {
      clrscr ();
      //dobj is object
  //of Demo Class
      Demo dobj;
      dobj.disp1();
      //dobj.disp2();
      //it can't accessible
      //dobj.disp3();
      cout<<"\n\tC++ is Superset of C";
      getch();

      }

No comments:

Post a Comment

Programmingway@Eklavya Technosys!: JTET 2026 | Computer Sections Solutions | Paper -II

Programmingway@Eklavya Technosys!: JTET 2026 | Computer Sections Solutions | Paper -II :   1) Which of the following is the extension of Not...