Jab bhi hum koi program bnatey hain to sab se pehley us program ka sketch bnatey hain ya logic design krtey hain k humare program me kon konsi data types use hongi.
Jo fields hum in the form of table save kr rhey hotey hain to sab se pehla sawal yeh zehn me ata hai k "What is table?". Table humare pass aik "Entity" hai. Jab bhi hum data type ki baat kr rhey honge to iska matlab yeh hai k hum "Entity" ki baat kr rhey honge.
"Entity" basically represent krti hai data type ko ya data type represent krti hai "Entity" ko.
For Example: Hum aik school system bna rhey hain to school system ko mad-e-nazar rakhtey huvey humare zehn me kya kya cheezey ati hain, woh humari "Entity" kehlaye gi (LIKE: Student, Teacher etc). "Student" humare pass "Entity" hogi aur "Student" k umbrella k under (Student name, Roll number, Fees, Course, Class etc) hoga. Humey yahan se aik data type identify hui jis ka naam "Student" hai. "Teacher" bhi humare pass aik "Entity" ya data type hai aur (Teacher name, salery etc) "Teacher" ki properties hongi.
Jesey hum baat krtey hain (byte, short, integer aur long data types etc) ki to in ki jo characteristics hain woh aik dafa define kr di gai hain k (byte, short, integer aur long data types) kis tarha ki hongi bilkul isi tarha "Abstract data type" me hoga k hum aik dafa data type ki jo characteristics define kren ge woh change nahi hongi.
Ab Jesey humney "Student" aur "Teacher" k naam ki 2 different "Abstract data types" banai ya "Entities" bnai. To "Student" aur "Teacher" ko jo cards miley hon ge (school ya college ya university) ki taraf se un me differnce hoga. Jesey "Student" k card me (Form#, Reciept#, Name, Course, Roll#, Valid upto etc) jesi properties ya attribute ya fields hongi. Ab "Student" k card me ye Jo 6 fields ya variables ya place holders hain yeh kisi na kisi data type ko represent kr rhey hon ge lakin yeh tamam fields mil kr aik "Entity" bnaye gi jo "Student" hogi Aur tamam "Students" k pass jo card hongey un pr yehi properties ya fields ya attributes hongey. Aesa nai ho sakta k kisi "Student" k pass in me se koi aik field ya property na ho ya phir aik field ya property zyada ho. Tamam "Students" ki yeh 6 properties ya variables hongey jo tamam "Students" me same hongey. Humare pass "Teacher" next "Abstract data type" hai aur "Teacher" ki data type "Student" ki data type se change hogi.
"Student" humare pass data type hogi lakin school ki class me mojood tamam students "Instance" ya "Object" kehlaye ge "Student data type" ka. "Instance" is basically a representation of that data type.
Ab jesey "salery" humare pass aik property hai. "Salery" to "Teacher" ko milti hai jab k "Student" fees pay krta hai.Jab aap "Entities" ko ya "Abstract data types" ko identify kren ge to unki "Properties" ko bhi identify kren ge.
Jab hum "Abstract data type"(user defined data type) ki baat krte hain to iska matlab hai k hum "Class" ki baat kr rhey hain. "Class" k ilawa bhi hum apni "Abstract data type" ko define kr saktey hain. "Class" is basically an "Entity". Jesey hi hum "Entity" ki baat kre ge to humey us "Entity" ki properties aur behaviors samajh ana shuru ho jayen ge. Jesey "Teacher class" ka behavior perhana hoga. "Class" ki properties noun hongi aur behaviors verb hon ge. "Properties" ko hum "Attributes" bhi kehtey hain.
Example#1: "Men" aur "Women" humarey pass 2 different "Classes" mojood hain aur in dono classes k different behaviors aur different properties hon gi. "Men" aur "Women" classes ya data types sirf aik dafa define ki gai hon gi. Ab jitney bhi "Men" aur "Women" hongey woh in classes ya data types k "Instance" hongey.
Example#2: "Laptop" class me laptop ki properties aur behaviors ko sirf aik dafa define kiya gya hoga. Laptop bnaney wali company ka aik assembling plant hoga jis me aik dafa define kiya gya hoga k is laptop ka model, color, memory, hard disk, RAM, proccesor etc kis tarha k hoga. Ab jitney bhi laptop is assembling plant me manufacture hon ge woh sab same hon ge. Tamam laptops jo is assembling plant se manufacture ho k nikley ge woh "Laptop data type" ya "Laptop class" ka "Instance" kehlaye ge.
Agar hum aesi "Class(data type)" bnatey hain jis ka koi "behavior" ya "property" na ho to us se humara koi objective achieve nahi hoga.