Saturday 29 July 2017

Lecture#4 ka Point#87 (Csharp Roman Hindi/Urdu Me).

Inheritance means 'warasat' hai. Aesi cheezey jo parent to child(top to bottom) muntakil hoti hain unhey inheritance kehtey hain. Jo child apne parent ki cheezon  ko use kr rha hai woh inheritance kehlati hai.


OOP(Object-oriented programming) ko agar aik word me define krna ho to woh hai reuseability. Reuseability inheritance ki wajah se hi possible hoti hai. Agar inheritance na hoti to child apne parent ki cheezo ko reuse nahi kr sakta. Inheritance me child apni parent ki cheezo ko 'As it is' use kr sakta hai ya modify kr k bhi use kr sakta hai.


Agar mere parent k pass car hai to agar mere parent mujhe allow kre ge to yeh car main bhi use krun ga na k parosiyon ka bacha is car ko use kre ga kyun k mere parent k saath main inherited hn, parosiyon ka bacha nahi.


Inheritance me parent ki common cheezey child use kr sakta hai, jesey aik ghar hai parent k naam pe jis me us k child bhi rehtey hain. Inheritance me common cheezey parent k pass hoti hain jab k uncommon cheezey child k pass hoti hain.

Friday 28 July 2017

Lecture#4 ka Point#86 (Csharp Roman Hindi/Urdu Me).

VB.NET me agar hum return type function ki return statement nahi mention krte ya kuch bhi return nahi krwatey to by-default VB.NET ka compiler aik 'NEW OBJECT' return krwaye ga, is ka matlab yeh hua k memory me aik 'NEW OBJECT' create hoga aur woh return ho jaye ga aur yeh object empty hoga, yeh cheez VB.NET me 'Runtime error' kehlaye gi jab k C# me yeh cheez 'Compile-time error' k tor pe show hogi. Yehi wajah hai k VB.NET 'Loosly coupled language' hai aur C# 'Tightly coupled language' hai.




Example Code of VB.NET (Module1.vb)
1 Module
2 Sub Main()
3 Console.Write(Add(1,1))
4 Console.ReadLine()
5 End Sub
6 Function Add(i AS Integer, j AS Integer) AS Long
7 Return i+j
8 End Function
9 End Module

Thursday 27 July 2017

Lecture#4 ka Point#85 (Csharp Roman Hindi/Urdu Me).

Compiler hamesha output 'true or false', ya 'sahi ya ghalat', ya '0 or 1' ki form me hi dega. Aesa nahi hoga k compiler humey in dono ki koi dermiyani value output return kre, is ka matlab yeh hua k compiler humey 'absolute value' dega like: '0 or 1', 'true or false' etc.



C# me function aik waqt me hamesha aik hi value return kre ga, aik se zyada value nahi return kre ga. C++ me hum function se aik waqt me aik se zyada values return krwa saktey hain with the help of 'reference call' ya 'pointer'.



.NET framework me 'pointer' ka concept nahi hai. Agar hum VB.NET ya C# me kisi function se aik se zyada values return krwana chatey hain to us k liye humey 'Array' use krna parey ga.



VB.NET is 'highly managed' code, matlab yeh k no pointer, no reference, no forget pointer, no out, no in etc. C# me hum 'managed' aur 'unmanaged' dono type k program likh saktey hain. 'unmanaged' code me hum 'pointer' wagera use kr saktey hain, aur 'unmanaged' code ki zimedari .NET ka CLR ya .NET ka framework nahi leta.

Wednesday 26 July 2017

Lecture#4 ka Point#84 (Csharp Roman Hindi/Urdu Me).

VB.NET 'loosly coupled language' hai aur C# 'tightly coupled language' hai. C# me no return type function me hum void ka keyword use krte hain jab k VB.NET me no return type function k saath hum sub ka keyword use krte hain. Agar hum C# me function ki return type likhtey hain lakin is function me return ki statement ya return keyword nahi likhtey to code compile nahi hota, is ka matlab yeh hua k jab humney function k saath is ki return type mention krdi to return ki statement ya keyword mendatory ho jaye ga jab k VB.NET me function ki return type mention krte hain lakin is function me return ki statement ya keyword nahi likhtey to code compile ho jaye ga aur is function ka output woh hoga jo is function ki return data type ki default value hogi, is ka matlab yeh hua k VB.NET 'loosly coupled language' hai. VB.NET me return type function k saath hum 'Function' ka keyword use kren ge jab k no return type function k saath hum 'Sub' ka keyword use kren ge, Sub ka matlab sub-routine hai aur sub-routine se muraad aesi functionality jo kuch return na kr rhi ho. Agar hum VB.NET me Function ka keyword use krtey huvey aik function bnatey hain lakin is function ki return data type mention nahi krte aur na hi is function me return ka keyword likhtey hain tab bhi humara code run ho jata hai. Agar hum VB.NET me function ka keyword use krtey huvey function bnatey hain aur return data type mention nahi krte to VB.NET ka compiler is function ko khud se default return data type assign kr de ga jo k 'Object' hogi. VB.NET me 'Object' aik aesi data type hai jo k 'apply for all' hai, aur 'apply for all' ka matlab hai k is me tamam data types mojood hongi jesey k string, long, integer, short, byte etc. VB6 me default return data type 'Variant' hai jo k 'apply for all' hai. C# me margin boht kam hota hai jab k VB.NET me margin boht zyada hota hai, is ka matlab yeh hua k VB.NET me jesey hum return type function me return data type aur return ka keyword mention nahi kr rhey hotey to VB.NET ka compiler us ki jagah function ki by-default data type aur by-default value return krwa rha hota hai, jis ki wajah se VB.NET me humey humara desired output nahi milta.

Tuesday 25 July 2017

Lecture#3 ka Point#83 (Csharp Roman Hindi/Urdu Me).

Jitni bhi primitive data types hain, they are structures. Structures aik aur tarika kaar hai data types ko represent krne ka.



Class aik tarika kaar hai data type bnaney ka. Classes k instances Heap me jatey hain. Heap is basically large memory pool area.



Structures k instances woh Stack me jatey hain. Stack is basically small memory pool area.



Stack pe FIFO method hota hai jab k Heap pe memory Traverse hoti hai.



Classes Heap pe jati hain isi liye hum classes k instances ko new k keyword se initialize krtey hain.



Stack pe humey memory space allocate krwane ki zaroorat nahi hai kyun k motherboard k upper jo register hain that is Stack.



Aik hi program k andar hum aik naam k 2 instances ya objects nahi bna saktey.



Aik hi naam k aik se zyada constructors with different signatures aur hi class me hon to isey hum constructor overloading kahen ge. Constructor overloading bilkul function overloading ki tarha hogi.




Example
class Arithmetic{
Public Arithmetic(){
height = 1;
}
Public Arithmetic(int height){ //parameter height is a local variable
this.height = height; //this.height is an instance variable & height is a local variable
}
private int height; //height is an instance variable
}

Monday 24 July 2017

Lecture#3 ka Point#82 (Csharp Roman Hindi/Urdu Me).

Class k instance variable ko jab declare krte hain to woh khud hi apni data type ki default value se initialize ho jata hai aur is instance variable ko is ki data type ki default value se is class ka default constructor ya constructor initialize krwata hai. Humey class k instance variables ki koi khud se value set krwani ho to usey hum constructor me initialize kre ge aur jesey hi humari class ka object initialize hoga to constructor call ho jaye ga aur instance variable ki value set ho jaye gi. Constructor values set kr rha hota hai aur values return nahi krta, values set krne me aur values return krne me farq hai. Constructor me hum woh kaam krte hain jo hum chahtey hain k jesey humara object initialize ho to woh call ho jaye.



FOR EXAMPLE: Jab koi insaan peda hota hai to us ki kuch values default me set hoti hain like; eyes ka color, hairs ka color, skin ka color etc to in properties ya values ko hum us insaan k constructor me initialize krwa den ge aur kuch properties ya values us insaan ki pehley se set nahi hongi like; naam etc to naam ki property hum khud set kren ge aur usey constructor me call nahi krwaye ge.



Constructor ka kaam hi properties me values set krna hota hai.

Sunday 23 July 2017

Lecture#3 ka Point#81 (Csharp Roman Hindi/Urdu Me).

Constructor(Basic member of class):

Constructors is a special type of functions. Constructor class k tamam functions me sab se top pe likha jaye hai. Constructor ka naam aur class ka naam same hona chahiye. Constructor ki return data type nahi hoti matlab yeh k constructor kuch bhi return nahi kre ga to is liye constructor k saath na to hum koi return data type likhtey hain aur na hi void ka keyword likhtey hain. Sirf constructor k saath us ka access modifier likhtey hain.



Constructor ki aik khaas property yeh bhi hai k jab hum constructor nahi bnatey to aik default constructor program me tab bhi mojood hota hai. Yeh kesey pata chaley ga k is program ki class ka default constructor hai? Woh is tarha k jab aap class ka object bna rhey hongey to new k keyword k baad jo aap ne class ka naam likha hoga us pe mouse hover kre to .NET Framework intellisense aap ko bta de ga k className.constructor(). Class ka object bnatey waqt constructor sirf aik dafa call hoga. Constructor ka kaam hota hai to initialize. Agar hum apna constructor bnaye ge to humara bnaya hua constructor hi call hoga jab k default constructor call nahi hoga.



Memory me jab aap koi object initialize kr rhey hotey hain to operating system se humara constructor request krta hai k is object ko memory allocate ki jaye ya memory me jaga di jaye. Constructor on the behalf of CLR, operating system se request krta hai k merey object ko memory allocate ki jaye(jitney us class k members space occupy kre ge utney size ki memory allocate hogi).

Saturday 22 July 2017

Lecture#3 ka Point#80 (Csharp Roman Hindi/Urdu Me).

Agar 2 functions same name k same class me hain lakin in k signatures different hain to isey hum function overloading ya method overloading kehtey hain. Function overloading ka taluq uski implementation, access modifier, return data type se nahi hoga balkey function overloading ka taluq us k naam aur signature se hoga. Agar function ka naam same hoga aur signature different hoga tb function overloading hogi. Function signature me arrangement of arguments ka matlab yeh hai k arguments ki data type ka arrangement change kr den.





Agar aik naam k two functions hain aur in dono functions k signature ka arrangement change hai.


FOR EXAMPLE:

Public long Add(int i, short j){......}            //first function


Public long Add(short i, int j){......}            //second function



Jab hum class se bahr in dono me se kisi aik function ko call kerwaye ge to is function k kisi aik argument k saath us ki type casting kre ge jis se identify hoga k hum kon sa function call krwa rhey hain. Agar hum type casting nahi kre ge to compile-time error aa jaye ga.


FOR EXAMPLE:

obj.Add(1, (short)1);            //call first function



Agar function ko call krwatey waqt function me koi parameter number without type casting pass krwaye ge to woh by-default integer hoga.


FOR EXAMPLE:

Public long Add(int i, int j){......}                 //first function



Public long Add(int i, short j){......}            //second function


obj.Add(1, 1);                                              //call first function


obj.Add(1, (short)1);                                  //call first function

Friday 21 July 2017

Lecture#3 ka Point#79 (Csharp Roman Hindi/Urdu Me).

Functions Signature:

For Example: Kya aik ghar me aik hi naam k 2 log ho saktey hain? jawab hai g haan bilkul ho saktey hain lakin woh is condition me k jab aap k ghar me aap k sath koi doosri family bhi reh rhi ho. Aik choti si Misaal de k main aap ko samjhane ki koshish krta hn k farz kren k maine apna ghar kisi ko rent pe diya hua aur jis ko maine apna ghar rent pe diya hai us ka aur mera naam same hai i.e. "SHUMAIL". Ab mere ghar koi shaks ata hai aur woh kehta hai k "SHUMAIL" ko bula do to mere ghar walo ko kesey pta chaley ga k woh shaks kis "SHUMAIL" ki baat kr rha hai? Woh aese pta chaley ga k us shaks ko "SHUMAIL" k naam k sath kuch makhsoos parameter provide krna pre ga like: "SHUMAIL Software house wala" ya phir "SHUMAIL Textile wala" etc to tb ja k mere ghar walo ko pta chaley ga k woh shaks kis "SHUMAIL" ko bula rha hai kyun k "There is an ambiguous reference between 2 SHUMAIL's". Bilkul is tarha ".NET Framework" me aik class k ander aik naam k 2 functions ho saktey hain lakin in dono functions k parameters change hon  ge. Function me hum jo parameter pass krwatey hain unhey hum signature ya phir function signature kehtey hain.




Functions Signature me 3 cheezey shamil hoti hain.


  1. Number of arguments/parameters.
  2. Type of arguments/parameters.
  3. Arrangement of arguments/parameters.

Hum Number of arguments/parameters, Type of arguments/parameters aur arrangement of arguments/parameters ko change kr den to humara function signature bhi change ho jaye ga. Function ko hum us k signature se pehchane ge. Function signature me agar number of argument, type of argument ya arrangement of argument me se koi aik cheez bhi change ker den ge to function signature change ho jaye ga.

Thursday 20 July 2017

Lecture#3 ka Point#78 (Csharp Roman Hindi/Urdu Me).

Jab hum apne program me data ko validate kr rhey hon ge ya phir data pe koi check lga rhey hongey to isey hum "Business logic" kahen ge. For Example: if(weight > 0){..........}



Agar instance variable jisey hum apne program ki kisi property(get & set) me use kr rhey hon ge to best practice yeh hai k according to requirement hum is instance variable ka access modifier private rakhey kyun k hum property me use values ko check lga k safe kr saktey hain lakin instance variable ki value ko safe nahi kr saktey matlab yeh k agar instance variable ka access modifier public hoga to koi bhi class k bahr se is instance variable ko access kr sakta hai aur is ki value change bhi kr sakta hai.



Wednesday 19 July 2017

Lecture#3 ka Point#77 (Csharp Roman Hindi/Urdu Me).

Agar variable humney function, constructor ya property(get & set) k ander declare kiya hoga to woh "local variable" kehlaye ga.



Agar kisi function me 2 integers add ho k return hon ge to hum us function ki return data type "long" rakhey ge kyun k aik achey programmer ki nishani hai k woh apne program ko hr aspect se soch rha hota hai. Agar misaal k tor pe yeh dono integers add ho k aesi value return kren jo integer data type ki maximum value se bari ho to us k liye humey integer se bari data type rakhni hogi i.e. "long data type".



Visual Studio me Intellisense ka matlab hai number of features(list members, parameter info, quick info & complete word).



Agar humney aik variable declare kiya hai jis ka scope "if statement" ya phir "loop" ki "curly brackets{}" k dermiyan me hai to yeh variable humey is "if statement" ya "loop" se bahr available nahi hoga.



"local variables" ka scope limited hota hai jis ki wajah se hum "local variables" k sath access modifiers use nahi krtey.