The OOP concept is about representing the real world concept in form of design class. So if you would like to find the application for group theory in OOP concept, look for the application of group theory in real life.
In theory we can adopt this concept to everything created in OOP world.
The object is just a shortcut for bag of properties, that store some value. When we create a object we gather those properties and enclose them with a name to simplify the communication.
As the object consists of properties, that have value. We can use algebra to work with them. The object as concept remain untouched, only the value of properties change. And the values of properties are the true representation of the object.
So lest go with the cars, this will be it structure
Car {
numberOfSeats
}
We have structure called Car
, with single property numberOfSeats
.
Our work data will be a car with 2 seats and car with 4 seats, respectively called car2 and car4.
Object car2 = Create Car with 2 seats.
Object car4 = Create Car with 4 seats.
So we have our two objects. Now lest do the math.
Object car6 = car2 + car4.
Behind the scene we create a new Car objects and add the values of numberOfSeats
. The product is new car with six seats.
This is how the concept works. So on this theory we can operate on anything. As the cars are not the best example as is really hard to do that in real life.
The truths is that this behavior depend on the developer head. We can design a game when we start with single square object, and when we collide with another square. Our start square increase with the size of that collided square. Another good example is type Money
, beside its value we have always currency. So it is more complex them number, but we can do with it every operation we can perform with numbers.