By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,996 Members | 896 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,996 IT Pros & Developers. It's quick & easy.

Class and Inheritance

P: n/a
Jam
Hello All,
Your comment is needed on following subject,i define the Class and
Inheritance as following,what do you think?

Class: Class is a set of objects which shares common states and
behaviors,Class can contain subclasses.
Inheritance: if two classes are having two common states and behaviors
or if a class is derived from another class it is called Inheritance,

All's comment is needed,is this defination ok or something more should
be here....?

With Kind Regards,
Jameel Sameemi

Aug 4 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On 2007-08-04 12:06, Jam wrote:
Hello All,
Your comment is needed on following subject,i define the Class and
Inheritance as following,what do you think?
Are you trying to come up with a definition of the concepts of class and
inheritance? If so, you are better of looking it up (you can find it all
over the net) than trying to get it right yourself.
Class: Class is a set of objects which shares common states and
behaviors,
What do you mean share? Do all objects belonging to a class have share
the state or what?
Class can contain subclasses.
Contain as in having them as members, if so what is a subclass?
Inheritance: if two classes are having two common states and behaviors
or if a class is derived from another class it is called Inheritance,
No, you can have two classes with identical states and behaviour without
any relationship between them. If a class is derived from another it has
inherited from it (that's the definition of inheritance).
All's comment is needed,is this defination ok or something more should
be here....?
A class is an abstract conceptual description of a type of objects, so
the class Car is an abstract description that can be applied to all cars
(at least all cars in the problem domain). A subclass is a more specific
abstraction of a subset of the class it derives from, so the class
electricCar is a subclass of Car, and gives a more detailed description
of electric cars, which are a subset of all cars.

--
Erik Wikström
Aug 4 '07 #2

P: n/a
"Jam" writes:
Your comment is needed on following subject,i define the Class and
Inheritance as following,what do you think?

Class: Class is a set of objects which shares common states and
behaviors,Class can contain subclasses.
Inheritance: if two classes are having two common states and behaviors
or if a class is derived from another class it is called Inheritance,

All's comment is needed,is this defination ok or something more should
be here....?
I don't like it at all. There is too much muddling of classes and objects.
I would not use the word "set" if I could avoid it, it may lead to undesired
inferrences, is there a problem with "group"? .
Aug 4 '07 #3

P: n/a
In article <11*********************@57g2000hsv.googlegroups.c om>,
ja************@gmail.com says...

[ ... ]
Class: Class is a set of objects which shares common states and
behaviors,Class can contain subclasses.
This simply isn't correct -- a class is NOT a set (or group, or anything
else) of objects. Rather, a class defines some state and behavior. You
can then 1) define objects of that class, or 2) define other classes
that inherit from the first class. In most cases, a particular class is
meant for one use or the other, but not both.
Inheritance: if two classes are having two common states and behaviors
or if a class is derived from another class it is called Inheritance,
Inheritance is a way for two (or more) classes to share common state
and/or behavior, there are also other ways for classes to share common
state/behavior -- for example, two classes can each embed an obect of a
third class.

--
Later,
Jerry.

The universe is a figment of its own imagination.
Aug 4 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.