
Now, a student can have many attributes like name, age, DOB, address, contact no., gender, height, weight, complexion, favorite food etc.īut an educational institution won’t ask for all these attributes from a student. The process of grouping these attributes and behaviors into a single unit is known as encapsulation. If you are preparing for placement, you will come across many interview questions on object-oriented programming concepts. These properties are attributes of a class and the operations are methods or behavior of a class. Like 'get fee structure', 'pay fee', 'get result' etc. In other words, Student class has various instances (or objects) and one of them is you.Įvery student has certain properties like name, roll no., class etc.Īlso, students can perform various operations For e.g.: a group of people like you can form a class called 'Student'. If we group a number of similar objects into one unit, we obtain a class. This brings us to the second concept of object-oriented programming – ‘Class’. The things that can be done by an object are called its behaviors.įor e.g.: a pen can write, so writing is its behavior.Ī formal definition of an object says – “Object is an instance of the class.” The current condition of an object is called its state.įor e.g.: a fan can have two states, on and off. In fact, you are also an object.Įvery object has three basic characteristics:įor e.g.: your roll number uniquely identifies you.



You may look around to find various objects like pen, table, fan etc. The major concepts of object-oriented programming include:
