Hi!
I am come back with my Problem...:confused:
Now,
I want to know that WHY use object in program. is program incomplete without using the Object/Classes
2) How many times I create new Object?
Just Suppose I want to Create Phone Book in C++. Now, How many objects/classes will be made? Is Phone Book Completed in one Object.
Regards.:p
Why use object in c++
Started by mindblaster, Aug 15 2009 10:43 AM
2 replies to this topic
#1
Posted 15 August 2009 - 10:43 AM
|
|
|
#2
Posted 15 August 2009 - 11:19 AM
You don't need to use objects at all, and sometimes shouldn't. Even with something as simple as a phone book program, you could easily have one, two, or multiple classes. You could also easily start using subclasses, depending on how complicated you want to make it.
Start by asking yourself a different question: what are you trying to do, and how can you organize the information you will need to keep track of?
Start by asking yourself a different question: what are you trying to do, and how can you organize the information you will need to keep track of?
#3
Posted 16 August 2009 - 06:06 AM
We use objects/classes to group the attributes of a perceived entity together in one 'package' that provides easy way of accessing those attributes and ensuring that all appropriate changes are propagated through the object/class.
Take a character in a video games, for example, you will may have an object for the head with attributes and methods for eye animations, facial expressions, etc. Likewise for arms, legs... all encompassed in one object called something like 'Character'. If the character's mood changes, this change in mood might be reflected with a frown, then changes associated with the frown might be propagated through the 'character object' to alter their posture accordingly.
Doing this without class objects would be a very big pain. :)
Take a character in a video games, for example, you will may have an object for the head with attributes and methods for eye animations, facial expressions, etc. Likewise for arms, legs... all encompassed in one object called something like 'Character'. If the character's mood changes, this change in mood might be reflected with a frown, then changes associated with the frown might be propagated through the 'character object' to alter their posture accordingly.
Doing this without class objects would be a very big pain. :)


Sign In
Create Account



Back to top









