Class and Inheritance

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jam

    Class and Inheritance

    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

  • =?ISO-8859-1?Q?Erik_Wikstr=F6m?=

    #2
    Re: Class and Inheritance

    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

    Comment

    • osmium

      #3
      Re: Class and Inheritance

      "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"? .


      Comment

      • Jerry Coffin

        #4
        Re: Class and Inheritance

        In article <1186222002.920 143.77940@57g20 00hsv.googlegro ups.com>,
        jameel.sameemi@ 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.

        Comment

        Working...