473,394 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Class and Inheritance

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
3 1563
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
"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Ricky Romaya | last post by:
Hi, Are there any ways to get multiple inheritace in PHP4? For example, I have 3 parent class, class A, B, and C. I want class X to inherit all those 3 classes. Consider merging those 3 classes...
6
by: Brian Jones | last post by:
I'm sure the solution may be obvious, but this problem is driving me mad. The following is my code: class a(object): mastervar = def __init__(self): print 'called a'
22
by: Marcin Vorbrodt | last post by:
Taken out of C++ In a Nutshell book... Example 7-18: Using an abstract classes as interface specification. struct Runnable { virtual void run() = 0; }; struct Hashable { virtual size_t...
9
by: mead | last post by:
What kind of classes is qualified as "concrete classes"? When should a member function in a class defined as "pure virtual" and when as "virtual"? Thanks!
4
by: KInd | last post by:
Hello All, When is nested class more preferable that Inheritance ? I think with proper inheritance and friend class concept we can get the same flexibility as nested classes Any comments .. Best...
166
by: Graham | last post by:
This has to do with class variables and instances variables. Given the following: <code> class _class: var = 0 #rest of the class
11
by: Darren.Ratcliffe | last post by:
Hi guys Posted what was probably a rather confusing post about this the other day, so I am going to have another go and see if I can make more sense. This sis purely a I've got a base class...
3
by: hurcan solter | last post by:
Consider the code fragment; class A { public: A(){} A(int prm):mprm(prm){} int mprm; }; class B:public A {
3
by: Ravi | last post by:
Is this the correct way to think of "base class"? The "base class" is a class from which other classes are derived. The "base class" will never be derived from another class.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.