Postfix operator should be defined like this :
student operator++(int unused)
{
student old(*this);
sub1=sub1*5;
sub2=sub2*5;
return old;
}
Now we can see why postfix operator should not be used when the old value is not used. This can hinder performance if the object is complex to copy.
By the way, with this version if you write
(obj1++).display()
, the old value will be printed as expected (as it would also be the case with built-in types like integers).