Classes of Object Oriented Programming

Home/Classes of Object Oriented Programming
Classes of Object Oriented Programming 2018-03-22T14:18:20+00:00

A class is group of objects with same attributes and common behaviours. It is basically a blueprint to create objects. An object is a basic key concept of OOP but classes provide an ability to generalize similar type of objects. Both data and functions operating on the data are bundled as a unit in a class for the same category of objects. Here to explain the term ‘same category of object’, let us take the example of mobile phone. A Windows phone, Android phone and i-phone, all fall into the category of mobile phones. All of these are instances of a class, say Mobile_phone and are called objects. Similarly we can have another example where students named Rani and Ravish are objects. They have properties like name, date of birth, address, class, marks etc. and the behaviour can be giving
examinations. Anybody pursuing any course, giving any type of examination will come into the category of students. So a student is said to be a class as they share common properties and behaviours. Although a student can be a school student, a college student or a university student or a student pursuing a music course and so on, yet all of these have some properties and behaviours in common which will form a class. An analogy is that you can have variables of type int which translates to saying that variables that store integers are variables which are instances (objects) of the int class.

 

PiRuby is the perfect Tool to Discover Educational Content from Textbooks. Learning and Excellence Made Easy… Really Easy!