Page 344 - CITS - CSA - TP (Volume 1) - Hindi
P. 344

कंप्यूटर सॉफ्टवेयर एप्लीकेशन- CITS



                                 private $radius;

                                 public function __construct($radius)
                                 {
                                               $this->radius = $radius;
                                 }
                                 public function getArea()

                                 {
                                               return MathConstants::PI * $this->radius * $this->radius;
                                 }

                         }
                                          $con= new MathConstants();
                                           $con->printConstants()
                         $circle = new Circle(5);
                         echo “Area of circle is:”. $circle->getArea(); // Output: 78.53975

                            ?>
                    </body>
                    </html>

           3   ो ाम को C:\Apache24\htdocs म  .php ए ट शन वाले फ़ो र म  सेव कर
           4  Apache सिव स को िवंडोज़ सिव स से रन कर
           5   ाउज़र ओपन कर  और िन  एड ेस टाइप कर
              http://localhost/foldername/
           6  रन करने के  िलए php फ़ाइल पर   क कर  और आउटपुट वेरीफाई कर


















           टा  2:  ास इनहे रट स का उपयोग करना
           1  टे  एिडटर ओपन कर
           2  िन िल खत कोड िलख

                 <html >
                    <head>
                          <title> Class inheritance </title>
                    </head>

                    <body>
                        <?php



                                                           328

                                       CITS : IT & ITES - कं  ूटर सॉ वेयर ए ीके शन - अ ास 60
   339   340   341   342   343   344   345   346   347   348   349