destructors

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • vaividhya@gmail.com

    #1

    destructors

    Q1:Can we call a destructor explicitly?If yes ,give example?
    Q2:What is difference between extensibility and inheritence?

  • osmium

    #2
    Re: destructors

    <vaividhya@gmai l.com> wrote:
    [color=blue]
    > Q2:What is difference between extensibility and inheritence?[/color]

    Extensibility is a word that belongs in a marketing presentation, like
    modular, efficacious and all that crap. I don't think it has any defensible
    technical meaning.


    Comment

    • Victor Bazarov

      #3
      Re: destructors

      vaividhya@gmail .com wrote:[color=blue]
      > Q1:Can we call a destructor explicitly?If yes ,give example?
      > Q2:What is difference between extensibility and inheritence?
      >[/color]

      Homework is for doing it yourself. What books do you use to study?

      Comment

      • Victor Bazarov

        #4
        Re: destructors

        osmium wrote:[color=blue]
        > <vaividhya@gmai l.com> wrote:
        >
        >[color=green]
        >>Q2:What is difference between extensibility and inheritence?[/color]
        >
        >
        > Extensibility is a word that belongs in a marketing presentation, like
        > modular, efficacious and all that crap. I don't think it has any defensible
        > technical meaning.[/color]

        I don't agree, but I don't think that discussion on this is beneficial to
        the OP. He/she needs to get a couple of good books and spend some time
        with them. Of course, the first book seems to be the dictionary, since
        the question asked is similar to "what is [the] difference between
        literacy and learning?"


        V
        --
        Please remove capital As from my address when replying by mail

        Comment

        • Phlip

          #5
          Re: destructors

          osmium wrote:
          [color=blue]
          > Extensibility is a word that belongs in a marketing presentation, like
          > modular, efficacious and all that crap. I don't think it has any
          > defensible technical meaning.[/color]

          A professor may have hearkened to the "Opened Closed Principle".

          I would answer "Inheritanc e is a physical mechanism, and extension is a
          logical technique. Inheritence may enable extension, as may generics,
          pointers, configuration tables, etc."

          The OP should not answer that, for reasons I hope are obvious. ;-)

          --
          Phlip
          http://www.greencheese.org/ZeekLand <-- NOT a blog!!!

          Comment

          • Victor Bazarov

            #6
            Re: destructors

            Phlip wrote:[color=blue]
            > osmium wrote:
            >
            >[color=green]
            >>Extensibili ty is a word that belongs in a marketing presentation, like
            >>modular, efficacious and all that crap. I don't think it has any
            >>defensible technical meaning.[/color]
            >
            >
            > A professor may have hearkened to the "Opened Closed Principle".
            >
            > I would answer "Inheritanc e is a physical mechanism, and extension is a[/color]

            Is it just me or do some people see what they like to see and not what
            is actually written? "Extensibil ity" is what the question is about, not
            "extension" . It doesn't change the fact that the question can't be
            answered, but still... I do hope we don't need to discuss the difference
            between "extension" and "extensibility" ... <g>
            [color=blue]
            > [...][/color]

            V
            --
            Please remove capital As from my address when replying by mail

            Comment

            • mlimber

              #7
              Re: destructors

              vaividhya@gmail .com wrote:[color=blue]
              > Q1:Can we call a destructor explicitly?If yes ,give example?[/color]

              See the FAQ:



              Cheers! --M

              Comment

              • Ravi Nakidi

                #8
                Re: destructors

                Hi Vaividhya,

                Yeah, you can call destructor explicitly. Ultimately, destructor is
                used free memory or do something the work left by object of that
                class. I mean clean of operations.

                For example, you created a pointer object of the class within the
                memberfunction of the class. say

                A *obj;

                obj = new A();

                --
                ---
                ---
                --
                --
                This allocated memory can't be destroyed until unless program ends.
                In this case U can call destructor explicitly in order to free the
                memory.

                In this case Destructor is like this.

                ~A()
                {
                delete this
                }

                this is very very important in case of larger projects other wise it
                yields memory problem.


                Coming 2 second question:

                extensibility is nothing but containership

                It is like this

                Adding some features to the class

                A
                |
                B

                Here from B to A.

                Where as in Inheritance A to B. Understand

                Regards,
                Ravi Nakidi

                Comment

                • Diego Martins

                  #9
                  Re: destructors

                  yeah! it is very good when someone solves our homework, huh? :-)

                  Ravi Nakidi wrote:[color=blue]
                  > Hi Vaividhya,
                  >
                  > Yeah, you can call destructor explicitly. Ultimately, destructor is
                  > used free memory or do something the work left by object of that
                  > class. I mean clean of operations.
                  >
                  > For example, you created a pointer object of the class within the
                  > memberfunction of the class. say
                  >
                  > A *obj;
                  >
                  > obj = new A();
                  >
                  > --
                  > ---
                  > ---
                  > --
                  > --
                  > This allocated memory can't be destroyed until unless program ends.
                  > In this case U can call destructor explicitly in order to free the
                  > memory.
                  >
                  > In this case Destructor is like this.
                  >
                  > ~A()
                  > {
                  > delete this
                  > }
                  >
                  > this is very very important in case of larger projects other wise it
                  > yields memory problem.
                  >
                  >
                  > Coming 2 second question:
                  >
                  > extensibility is nothing but containership
                  >
                  > It is like this
                  >
                  > Adding some features to the class
                  >
                  > A
                  > |
                  > B
                  >
                  > Here from B to A.
                  >
                  > Where as in Inheritance A to B. Understand
                  >
                  > Regards,
                  > Ravi Nakidi[/color]

                  Comment

                  Working...