Difference Between Class and Object………..

Object Oriented Programming, or OOP, is a very popular style of programming, due to its ability to handle more complex applications with a lot more code. This is because it organizes the data into objects that are comparable to real life objects. Class and object are two terms that are commonly used in OOP. In its most basic form, objects are the instantiation of classes.

In order to use objects in a program, you need to declare the properties and procedures in a class. For us to visualize this better, let’s discuss this using an example. If you want to create a program that deals with vehicles, you will need to create a class for vehicles. In the class you would create variables that will hold information relevant to vehicles. Values like passenger capacity, top speed and fuel capacity are typical along with procedures like start and stop. After creating the class for vehicles, you can now create objects in your application that are based on the vehicle class. You can create an object called car or motorcycle that is based on vehicles. You can then fill up the relevant information on the object, and use it as you deem fit in your application.

As you already may have deduced from the example discussed above, the information that you will really use in an application are stored in the object, and not in the class. The class only defines the structure of the data, and what each procedure or function does.

SHARE THE KNOWLEDGE


Advertisements

About Dinesh

I am engineering student........ I am selected in Microsoft Student Partner as MSP............

Posted on February 12, 2011, in C++, Knowledge. Bookmark the permalink. 2 Comments.

  1. Walk Bright,great unemployment most violence double early advantage distance assess academic beside prime theatre thought merely village year ancient complex manage out supply nuclear relatively need situation light finding maybe hell support murder debt hence observation speak rare spring should until emphasis affect cup city one sit throw explain warm major payment return afraid over campaign company end condition move description test ourselves head threaten piece threat ring ordinary critical notice secure rest vehicle more discussion pocket son too context negotiation credit blue behaviour regional use perfect appoint say entitle lift bedroom

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: