This simplified concept of cars and trucks both being kinds


The below from the discussion post. This need to respond in 4 to 6 sentences. This need to reply to the author. This is from software development distribute system. Need help to post.

When it comes to classes and objects I have heard and used many different ways to describe their relationship. Choosing which one to use usually depends on who I am talking to and what I believe they would be best to help them understand the two. Having an automotive background one I often go to is the idea that you can have an automobile class. Now there are many different automobiles out there like cars and trucks. These can actually be broken down further into sports cars, sedans, pick-up trucks, semi-trucks, etc. but I'll keep it simple for this discussion. If you have an automobile class, you could have a car object and then another truck object. Each share the properties of the automobile class such as having four wheels and uses gasoline, but each has their own object properties such as the truck having two doors and a cargo bed while the car has four doors and a smaller cargo trunk.

This simplified concept of cars and trucks both being kinds of automobiles with shared properties and individual properties helps to explain the relationship of classes and objects. In languages such as Java this concept can be expanded on with the idea that an object of a class can also be a class to another object. Using our automobile example again, the class automobile has an object truck, their shared properties include four wheels and a gas tank its individual properties include doors and a truck bed. Now the object truck acting as a class has another object four wheel drive truck. The four wheel drive truck now has all the properties of automobile and truck, but also has its own properties of having a transfer case. But this gets more into the idea of inheritance rather than just classes and objects.

If you look at the example above, a class is the basic framework that all automobiles have in common, and each object is the specific kind of automobile with its own individual properties as well as those included from the class itself. Now not everyone would get this particular analogy, but those who have an automotive or mechanical background probably would. That is why I also state choosing which analogy to use depends on who I am talking to. But all analogies regarding classes and objects are really trying to help people visualize the concept of a hierarchy in programming. You have the base class of all objects of a particular type, then you have objects that are the different kinds of that base class.

Solution Preview :

Prepared by a verified Expert
Business Economics: This simplified concept of cars and trucks both being kinds
Reference No:- TGS02316939

Now Priced at $10 (50% Discount)

Recommended (97%)

Rated (4.9/5)