I have read that behavior of an object is the action performed by the object(in real life situation) but in programming, context is it not the operation/action performed on the object as described by the method.
For example in the code below we have a method to display the full name of the employee. In this case, the action is performed by the object or is it the action is performed on the object?. How can displaying full name be a behavior of an object when we compare it to the behavior of a dog object(Like barking, sleeping, etc). Thanks for your help
class employee:
raise_value=1.05
def __init__(self,first,last,pay):
self.first=first
self.last=last
self.pay=pay
def emp_fullname(self):
return "Full name is {} {}".format(self.first,self.last)
def set_raise(self):
self.new_sal=float(self.pay)*employee.raise_value
return 'My new salary is {}'.format(self.new_sal)
e1=employee("Chyanit","Singh","60000")
e2=employee("Parag","Singh","40000")
e1.emp_fullname()