மரபியல்பு (கணினியியல்): திருத்தங்களுக்கு இடையிலான வேறுபாடு

1,585 பைட்டுகள் சேர்க்கப்பட்டது ,  15 ஆண்டுகளுக்கு முன்
சி
தொகுப்பு சுருக்கம் இல்லை
உள்ளடக்கம் நீக்கப்பட்டது உள்ளடக்கம் சேர்க்கப்பட்டது
Natkeeran (பேச்சு | பங்களிப்புகள்)
சி Removed category "நிரலாக்கம்"; Quick-adding category "பொருள் நோக்கு நிரலாக்கம்" (using HotCat)
Natkeeran (பேச்சு | பங்களிப்புகள்)
சிNo edit summary
வரிசை 2:
 
மேல்நிலை வகுப்புக்கள் அல்லது [[மீவுவகுப்பு]]க்களில் இருந்து கீழ்நிலை வகுப்புக்களை வரையறை செய்யலாம். உதாரணமாக, வடிவம் என்ற வகுப்பில் இருந்து [[வட்டம்]] என்ற வகுப்பை வரையறை செய்யலாம்.
 
== பி.எச்.பி எடுத்துகாட்டு ==
பி.எச்.பி இல் [[பொருள் நோக்கு நிரலாக்கம்]] செய்ய முடியும். ஒரு எளிய எடுத்துக்காட்டு கீழே. இந்த எடுத்துக்காட்டில் var, $this ஆகியவை keywords என்பது குறிப்பிடத்தக்கது.
 
<div style="float:left; width:50%;">
<pre>
<?php
 
include("C:\Documents and Settings\HP_Owner\Desktop\calc.php");
 
$c1 = new Calculator;
$c1->set_numbers(1,3);
echo "This sum is: ".$c1->sum()."<br />";
echo "The multiple is: ".$c1->mul()."<br />";
 
$c2 = new Calculator2;
$c2->set_numbers(5,2);
echo "This sub is: ".$c2->sub()."<br />";
?>
</pre>
</div>
<div style="float:right; width:50%;">
<pre>
This sum is: 4
The multiple is: 3
This sub is: 3
</pre>
</div>
<br style="clear:both;"/>
 
* calc.php கோப்பு
<pre>
<?php
 
class Calculator {
//class-wide variables
var $x;
var $y;
//function to gather two numbers
function set_numbers($num1, $num2){
$this->x = $num1;
$this->y = $num2;
}
//function to add numbers together
function sum(){
$ans = $this->x + $this->y;
return $ans;
}
function mul(){
$ans = $this->x * $this->y;
return $ans;
}
 
}
 
class Calculator2 extends Calculator {
function sub(){
$ans = $this->x - $this->y;
return $ans;
}
}
?>
</pre>
 
 
67,612

தொகுப்புகள்

"https://ta.wikipedia.org/wiki/சிறப்பு:MobileDiff/331457" இலிருந்து மீள்விக்கப்பட்டது