Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 28-02-2009
Member
 
Join Date: Feb 2009
Posts: 10
What is the Difference between Class and Object?

Hi,

What is the Difference between class and object?

Regards,
Reply With Quote
  #2  
Old 28-02-2009
Member
 
Join Date: Jan 2009
Posts: 38
Re: What is the Difference between Class and Object?

An object is an instance of a class.

Such that, if class is:
class MyClass {
public:
int x;
};

Than an object would be:
int main()
{
MyClass my_object;
}
Reply With Quote
  #3  
Old 28-02-2009
Member
 
Join Date: May 2008
Posts: 115
Re: What is the Difference between Class and Object?

A Class is static. All of the attributes of a class are fixed before, during, and after the execution of a program. The attributes of a class don't change. The class to which an object belongs is also (usually) static. If a particular object belongs to a certain class at the time that it is created then it almost certainly will still belong to that class right up until the time that it is destroyed. An Object on the other hand has a limited lifespan. Objects are created and eventually destroyed. Also during that lifetime, the attributes of the object may undergo significant change.
Reply With Quote
  #4  
Old 28-02-2009
Member
 
Join Date: May 2008
Posts: 2,383
Re: What is the Difference between Class and Object?

Class is a template(type) or blue print its state how objects should be and behave. eg consider a construction plan which is a class with this description mentioned in a plan we can constructs 'n' number of buildings of same type.
these buildings are consider to be an objects come under same type of that plan. Object is defined as a software construct which binds data
and logic or methods(functions)together.

In short: Class is templet for an object.Object is an instance of a class.
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
  #5  
Old 28-02-2009
Member
 
Join Date: Feb 2008
Posts: 1,848
Re: What is the Difference between Class and Object?

An object is a software bundle of related state and behavior. Software objects are often used to model the real-world objects that you find in everyday life. This lesson explains how state and behavior are represented within an object, introduces the concept of data encapsulation, and explains the benefits of designing your software in this manner.

A class is a blueprint or prototype from which objects are created. This section defines a class that models the state and behavior of a real-world object. It intentionally focuses on the basics, showing how even a simple class can cleanly model state and behavior.
Reply With Quote
  #6  
Old 28-02-2009
Member
 
Join Date: Jan 2008
Posts: 1,515
Re: What is the Difference between Class and Object?

Let us consider the class car. Cars have a body, wheels, an engine, seats, are used to transport people between locations, and require at least one person in the car for it to move by its own power. These are some of the attributes of the class - car - and all members that this class has ever or will ever have share these attributes.

The members of the class - car - are objects and the objects are individual and specific cars. Each individual car has a creation date (an example of an object having an attribute that is static), an owner, a registered address (examples of attributes that may or may not change), a current location, current occupants, current fuel level (examples of attributes that change quickly), and it may be covered by insurance (an example of an attribute that may or may not exist).

To use a more programming related example, the class window has edges, a title bar, maximize and minimize buttons, and an area to display the window contents. A specific window has a location on the screen, a size, a title, and may or may not have something in the content area.

So basically the difference between a class and an object is that a class is a general concept while objects are the specific and real instances that embody that concept. When creating an object oriented program we define the classes and the relationships between the classes. We then execute the program to create, update, and destroy the objects which are the specific realization of these classes.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "What is the Difference between Class and Object?"
Thread Thread Starter Forum Replies Last Post
Getting HP AIO Device object server register class object failed message on my system Donoho Hardware Peripherals 6 06-06-2011 01:34 AM
What is the difference between Local class and global class in C++? Dėfrim Software Development 4 03-01-2011 10:44 PM
Debug class and Trace class Difference Amaresh Software Development 5 22-01-2010 10:00 AM
Difference among concrete class and abstract class Roxy_jacob Software Development 4 07-12-2009 01:22 PM
Class Object in C++ paintbox Software Development 0 25-10-2008 01:13 PM


All times are GMT +5.5. The time now is 05:55 PM.