Saturday 29 April 2017

Lecture#2 ka Point#75 (Csharp Roman Hindi/Urdu Me).

FUNCTION(BASIC MEMBER OF CLASS):

Function is a set of instructions. Program likhtey waqt kuch cheezey aesi hoti hain jinhey hum bar bar repeat kr rhey hotey hain to woh set of instructions jinhey hum bar bar repeat kr rhey hotey hain unhey hum function me convert kr letey hain.



Function bnaney ka maqsad code ko re-use krna hai.



Humara function alag hota hai aur humara program alag hota hai. Hum function ko apne program me call krtey hain. Humare program ka control jump kr jata hai us function pe jisey humney apne program me call krwaya hai aur woh pura function execute hota hai aur function execution jb khattum hoti hai to control wapis transfer ho jata hai program ki us line k very next jahan humney woh function call krwaya hoga.



Function ka koi "access modifier" hoga, koi "name" hoga aur kuch "attributes" & "properties" hongi. Function ko hum Sub-routine ya method ya procedure bhi kehtey hain.



Aik function woh hai jo aap se kuch input le aur us input ko process krne k baad kuch value return kre. Aik function woh hai jo koi value return nahi krta. Jo function value return kre ga hum us k sath uski return data type bhi mention kre ge.


FOR EXAMPLE: Public long Add(int i, int j){ return i+j; }



Jo function value return nahi krta us k sath hum void ka keyword likhtey hain. void ka matlab hota hai "no return data type".
FOR EXAMPLE: Public void Print(){ Console.WriteLine("Muhammad Shumail Cheema"); }



Jo variable hum function k scope ya "curly brackets{}" k ander likhen ge woh humara "local variable" kehlaye ga. "Local variable" ka scope function se bahir nahi hoga.



"Local variables" apni data type ki default value se initialize nahi hotey. Sirf "instance variables" apni data type ki default value se initialize hotey hain.

Friday 28 April 2017

Lecture#2 ka Point#74 (Csharp Roman Hindi/Urdu Me).

Agar humare Student k card me "Name", "Roll#", "Course", "Class" aur "Phone#" ki total 5 fields hain to is ko mad-e-nazar rakhtey huvey humare program me 5 variables alag baney ge aur 5 properties alag baney gi(i.e. 5 gets aur 5 sets bhi bney ge).



Agar hum "property" likhtey waqt "get" likhen lakin "set" ka block code na likhen to isey hum "Read-only property" kehtey hain.


FOR EXAMPLE:
Public int RollNo
{
get
{
return rollno;
}
}

"Read-only property" me value assign nahi kr saktey iska matlab yeh hua k value constant rhey gi aur value change nahi hogi.



Agar hum "property" likhtey waqt "set" likhen lakin "get" ka block code na likhen to isey hum "Write-only property" kehtey hain.


FOR EXAMPLE:
Public int RollNo
{
set
{
rollno = value;
}
}

"Write-only property" me hum sirf property k through variable ko value assign kr saktey hain.



Agar hum "property" likhtey waqt na "get" ka block code likhen aur na hi "set" ka block code likhen to yeh "property" hi nahi rhey gi. "Property" bnaney k liye kam se kam aik "accessor(get ya set)" hona lazmi hai.

FOR EXAMPLE:
Public int RollNo
{
}

Agar hum "property" likhtey waqt "get" bhi likhen aur "set" bhi likhen to isey hum "Both property" kahen ge.


"VB.NET" me humey "property" k saath likhna hota hai k yeh "Read-only property" hai ya "Write-only property" hai ya phir "Both property" hai.

Thursday 27 April 2017

Lecture#2 ka Point#73 (Csharp Roman Hindi/Urdu Me).

Property ko hum "get" aur "set" krwa rhey hotey hain. Property ko hum "accessor" bhi kehtey hain("get accessor" ya "set accessor").




Program likhtey waqt proper name convension honi chahiye. Jesey mera naam "Muhammad Shumail Cheema" hai to "Muhammad" mera first name, "Shumail" mera middle name aur "Cheema" mera last name hoga. yeh mera proper naam hai. aesa nahi hoga k mera naam "Shumail123" ho ya phir "Shumail_@" ho. is cheez ko hum proper name convension kehtey hain. Bilkul isi tarha jab developer program bnaye ga to woh apne variables, properties aur functions k naam proper rakhey ga.




Mera naam "Muhammad Shumail Cheema" hai to "Muhammad" ka "M", "Shumail" ka "S" aur "Cheema" ka "C" capital hoga. isey hum "Casing" kehtey hain. Developers ko bhi chahiye k jab woh program likh rhey hon to apne variables, properties aur functions k naam casing k saath likhain. "Muhammad Shumail Cheema" k naam me "pascal casing" use hui hai aur "muhammad Shumail" k naam me "camel casing" use hui hai.



Agar koi code ko dekh k bta de k is ka output kya aye ga to isey hum "Dry Run" kehtey hain. is ka matlab yeh hua k aap apney dimagh ko as a compiler use krtey huvey dimagh me program ka sketch bnao ge aur is ko mad-e-nazar rakhtey huvey program ka output btao ge.



Jab hum project bna k usey compile aur run krwatey hain to yeh aik "Cost" hai. Program ko build krna, Program ko compile krna aur program ko release krna that is a "Cost".



"Dry Run" ko hum "Unit testing" bhi kehtey hain.

Wednesday 26 April 2017

Lecture#2 ka Point#72 (Csharp Roman Hindi/Urdu Me).

byte, short, integer aur long data type ki by-default value "0" hogi (for signed and unsigned data types). boolean data type ki default value "False" hogi. "char" aur "string" data type ki default value "empty" hogi. "decimal", "float" aur "double" ki default value "0" hogi.


Agar boolean ki 8bits me se 7bits "0" ya "OFF" hain aur 1bit "1" ya "ON" hai to answer "TRUE" aye ga kyun k in tamam 8bits me se 1bit "ON" ya "1" hai.


"NULL" ko hum special data type bhi kehtey hain.


"Heap" and "Stack" is basically a type of memory.


PROPERTIES (BASIC MEMBER OF CLASS):  


Purani languages me class me properties ka concept nahi hota tha. Properties hum use krtey hain to "get" and "set" a value "To/From" the variable.


Error humare pass 3 types k hotey hain.


  1. Compile time error.
  2. Runtime error.
  3. Logical error.




"Logical error" woh error hota hai jo input ki wajah se ata hai. FOR EXAMPLE: Jesey k student ka Roll# hai woh hamesha "positive" me hoga lakin agar user "negative" me input dega to woh logical error kehlaye ga. Logical errors ko control krne k liye hum program me kuch modifications kre ge aur properties bnaye ge.


Syntax of property
Public int RollNo{.....} → Property
Public int RollNo; → variable

Purani languages me hum variable me value "set" aur "get" krne k liye hum functions bnatey thay. FOR EXAMPLE: getRollNo() aur setRollNo(). Lakin .NET Framework me values ko "get" aur "set" krwane k liye hum propertties bnatey hain.
Line No. Code Comments
1 class Student
2  {
3  Public int rollno; //instance variable or data member.
4  Public int RollNo //property or function member.
5   {
6   get
7    {
8    return rollno;
9    }
10   set
11    {
12    rollno = value; //"value" is a keyword. jo value RollNo ki set kre ga woh value hi is "value" ke keyword me aye gi.
13    }
14   }
15  }
16 class Program
17  {
18  static void Main(string[] args)
19   {
20   Student Haroon = new Student();
21   Haroon.RollNo = 4945; //to set the property "RollNo"
22   Console.WriteLine(Haroon.RollNo); //to get the property "RollNo"
23   Console.ReadLine();
24   }
25  }
OUTPUT:                  4945

Tuesday 25 April 2017

Lecture#2 ka Point#71 (Csharp Roman Hindi/Urdu Me).

Jo cheez "curly brackets{}" k dermiyan mojood hogi to yeh is cheez ka scope kehlaye ga.



Agar kisi variable ka scope class k kisi function ya constructor me define na ho ya class k ander root pe hi varriable define ho to woh humare pass "Instance variable" kehlaye ga.




Variable declarationStudent Haroon;


Variable initializationStudent Haroon = new Student();

Instance variable ko hum class-level variable bhi kehtey hain.


Student Haroon = new Student(); me Haroon naam ka variable memory me declare ya define ho jata hai jis ki data type ya class Student hai lakin yeh variable memory me tb tak exists nahi kre ga jab tak hum is variable ko new k keyword k sath initialize na krwa le.



.NET Framework me hum jab bhi koi program bna rhey hongey to aik "memory pool area" hoga jo humare program k liye reserve ho jaye ga aur jitne bhi instances ya objects hongey memory me woh is "memory pool area" me initialize hongey.



Program ka "memory pool area" alag hota hai aur variables ka "memory pool area" alag hota hai.



C#(C sharp) me agar hum kisi cheez k sath access modifier nahi likhtey to woh cheez by-default "Private" hogi jab k VB.NET me agar hum kisi cheez k sath access modifier nahi likhtey to woh cheez by-default "Public" hogi.



VB.NET is slightly "loosly coupled system".



Agar humney apne instance variable ko declare to kiya lakin initialize nahi kiya to by-default woh instance variable apni default value se initialize ho jaye ga. FOR EXAMPLE: byte b; me "b" instance variable hai aur is ki data type "byte" hai aur "byte" data type ki default value "0" hai to is ka matlab yeh hua k byte b = 0; .



Hr data type k by-default tamam bits us waqt tk "OFF" ya "0" hotey hain jab tk us data type ka variable initialize nahi ho jata.

Monday 24 April 2017

Lecture#2 ka Point#70 (Csharp Roman Hindi/Urdu Me).

BASIC MEMBERS OF ABSTRACT DATA TYPE(ABSTRACT CLASS):-

  1. Variables.
  2. Properties.
  3. Functions(Methods/Procedures/Sub-Routines).
  4. Constructor.

Basic members of class me Variable ko hum "data member" bhi kehtey hain. Data member ka matlab aesi cheez jo memory k andar data ko hold kre ya hum aasan alfaz me yeh bhi keh saktey hain k variable aik aesi cheez hai jis me humara data store hota hai.



Basic members of class me Properties, Functions aur Constructor yeh sab class k behaviors hain.


For Example
byte b = 100 ;


byte   →   Data type.
b    →   Variable ya placeholder.
=    →   Assignment Operator.
100   →   Data.
;    →   Line terminator.


Variable data ko represent krta hai with data type. Variable humare pass placeholder hai jahan hum memory k andar data ko store kertey hain. Yeh placeholder kisi data type ko represent krta hai aur jis datatype ko represent krta hai isi type ka data is placeholder me store hoga is k ilawa kisi doosri type ka data is placeholder me store nahi hoga. To hum yeh bhi keh saktey hain k humare pass variable specific data type k honge.



FOR EXAMPLE: Variable ya to byte data type ka hoga ya phir short data type ka hoga ya kisi bhi data type ka hoga lakin aesa bilkul bhi nahi hoga k yeh variable short data type ka bhi ho aur byte data type ka bhi ho kyun k yeh variable kisi aik (specific) data type ko represent kre ga ya hum yeh bhi keh saktey hain k is variable ki aik (specific) data type k data ko apney andar store kre ga.



Variable ne temporary ya kuch time k liye data ko memory me hold kiya hoga aur jesey hi hum apna program close kren ge to yeh variable memory se flush out ho jaye ga.



Variables humare pass 2 types k hotey hain.

  1. Instance Variable.
  2. Local Variable.

Sunday 23 April 2017

Lecture#2 ka Point#69 (Csharp Roman Hindi/Urdu Me).

Jab hum class ki baat kren ge to humare pass "Access modifiers" honge jis ki madad se hum limitations define kr saktey hain.



"Public (access modifier)" ka matlab hai k jo cheez publically available ho aur "Private (access modifier)" ka matlab hai k jo cheez makhsoos(private) logo ko available ho.



For example: ab aik teacher hai woh student ki class conduct kr rha hai. Us class me multimedia(projector) lga hua hai jo teacher k laptop se connected hai. To multimedia(projector) ka access modifier "public" hoga kyun k projector ko teacher aur student dono dekh saktey hain jab k teacher k laptop ka access modifier "private" hoga kyun k laptop ko sirf teacher hi dekh sakta hai.



"Public" aur "private" access modifiers ko hum "Basic access modifier" bhi kehtey hain.



"Protected" aur "friendly" bhi humare pass access modifiers hain jinhey hum "advance access modifier" bhi kehtey hain.



For example: aik class hai jis me teacher students ki class conduct kr rha hai. Us class me projector hai jo laptop se connect hai. Ab projector class me mojood tamam logo k liye "public"  access modifier hai jab k class se bahr mojood tamam logo k liye "private" access modifier hai.



Class me mojood kisi bhi cheez ka access modifier agar "private" hoga to is class ki koi bhi cheez humey is class se bahir available nahi hogi. Lakin agar is class ki kisi bhi cheez ka access modifier "public" hoga to woh class k bahir bhi available hogi.



Example: Ab jesey student k card pe student ka name, roll#,course etc likha hua hota hai lakin fees nahi likhi hui hoti kyun k fees ka access modifier "private" hai.