473,766 Members | 2,044 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1585
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************ *********@57g20 00hsv.googlegro ups.com>,
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
3243
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 is out of the question, as there are class Y which only inherits from class A, etc. TIA
6
3195
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
5838
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 hash() = 0; };
9
5887
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
4030
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 Regards KInd --
166
8663
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
2876
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 called animal, and from within animal you can access lots more classes such as feline, canine, reptile and amphibian.....
3
2252
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
1669
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
9568
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10168
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9837
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6651
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5279
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.