Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Subclassing

Subclassing

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++
24 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Scorpio

    but inheretance also seems to do the same thing

    T Offline
    T Offline
    toxcct
    wrote on last edited by
    #8

    NiLeSh KoRpE wrote:

    but inheretance also seems to do the same thing

    :~ did you read my 1st post ? "another good term for this is also inheritence" yes, it is exactly the same... 2 different word for the same thing. :zzz:


    TOXCCT >>> GEII power

    [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

    1 Reply Last reply
    0
    • V voorugonda prashanth

      what is subclassing actually?? how do u create a subclass in SDK and MFC? Thanks in advance Regards, Prashanth.v

      V Offline
      V Offline
      VinayCool
      wrote on last edited by
      #9

      ar u frm AP ?

      T V 2 Replies Last reply
      0
      • V VinayCool

        ar u frm AP ?

        T Offline
        T Offline
        toxcct
        wrote on last edited by
        #10

        are you typing with your phone ? :~


        TOXCCT >>> GEII power

        [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

        S V 2 Replies Last reply
        0
        • T toxcct

          are you typing with your phone ? :~


          TOXCCT >>> GEII power

          [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

          V Offline
          V Offline
          VinayCool
          wrote on last edited by
          #11

          No;)

          1 Reply Last reply
          0
          • T toxcct

            are you typing with your phone ? :~


            TOXCCT >>> GEII power

            [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

            S Offline
            S Offline
            Scorpio
            wrote on last edited by
            #12

            Can u brief something about subclassing dialogitem and subclassing window

            T 1 Reply Last reply
            0
            • V VinayCool

              ar u frm AP ?

              V Offline
              V Offline
              voorugonda prashanth
              wrote on last edited by
              #13

              yes. n what abt u?

              1 Reply Last reply
              0
              • S Scorpio

                Can u brief something about subclassing dialogitem and subclassing window

                T Offline
                T Offline
                toxcct
                wrote on last edited by
                #14

                search codeproject[^]


                TOXCCT >>> GEII power

                [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

                1 Reply Last reply
                0
                • M Maxwell Chen

                  toxcct wrote:

                  class ChildClass : BaseClass {

                  class ChildClass : **public** BaseClass { class ChildClass : **protected** BaseClass { class ChildClass : **private** BaseClass {


                  Maxwell Chen

                  V Offline
                  V Offline
                  VinayCool
                  wrote on last edited by
                  #15

                  Yes u ar correct Max :~

                  1 Reply Last reply
                  0
                  • V voorugonda prashanth

                    what is subclassing actually?? how do u create a subclass in SDK and MFC? Thanks in advance Regards, Prashanth.v

                    V Offline
                    V Offline
                    VinayCool
                    wrote on last edited by
                    #16

                    which company are u working ??

                    V 1 Reply Last reply
                    0
                    • V VinayCool

                      which company are u working ??

                      V Offline
                      V Offline
                      voorugonda prashanth
                      wrote on last edited by
                      #17

                      i'm working for zilog,bangalore. n u?

                      V 1 Reply Last reply
                      0
                      • V voorugonda prashanth

                        i'm working for zilog,bangalore. n u?

                        V Offline
                        V Offline
                        VinayCool
                        wrote on last edited by
                        #18

                        why did u left spatial technologies(I) Ltd,Hyd. ???

                        V 1 Reply Last reply
                        0
                        • V VinayCool

                          why did u left spatial technologies(I) Ltd,Hyd. ???

                          V Offline
                          V Offline
                          vikramlinux
                          wrote on last edited by
                          #19

                          What a discussion thread and out of context topics !!! .

                          S 1 Reply Last reply
                          0
                          • V vikramlinux

                            What a discussion thread and out of context topics !!! .

                            S Offline
                            S Offline
                            Scorpio
                            wrote on last edited by
                            #20

                            not really all NiLeSh KoRpE

                            V 1 Reply Last reply
                            0
                            • S Scorpio

                              not really all NiLeSh KoRpE

                              V Offline
                              V Offline
                              voorugonda prashanth
                              wrote on last edited by
                              #21

                              sorry all.

                              1 Reply Last reply
                              0
                              • T toxcct

                                subclassing is not a MFC nor SDK concept but a C++ (and even general OO) concept. it means using a base class to reuse its behavior/design/methods and not reinventing the wheel... another good term for this is also inheritence


                                TOXCCT >>> GEII power

                                [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

                                B Offline
                                B Offline
                                BadKarma
                                wrote on last edited by
                                #22

                                Is always tought that subclassing was to change the behaviour of a class in a framework without changing the framework. I guess i'm wrong but what is then the correct term for this kind of pattern. Let me explain by a simple example. You create your own windowproc which is then used to overwrite the normal winproc. By using your own windowproc you can change the behaviour of the subclassed window. codito ergo sum

                                T 1 Reply Last reply
                                0
                                • B BadKarma

                                  Is always tought that subclassing was to change the behaviour of a class in a framework without changing the framework. I guess i'm wrong but what is then the correct term for this kind of pattern. Let me explain by a simple example. You create your own windowproc which is then used to overwrite the normal winproc. By using your own windowproc you can change the behaviour of the subclassed window. codito ergo sum

                                  T Offline
                                  T Offline
                                  toxcct
                                  wrote on last edited by
                                  #23

                                  in what way would that be different from what i explained ? you can always inherit from a base class and override some functions do change the behavior, or had some new features... ;)


                                  TOXCCT >>> GEII power

                                  [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

                                  B 1 Reply Last reply
                                  0
                                  • T toxcct

                                    in what way would that be different from what i explained ? you can always inherit from a base class and override some functions do change the behavior, or had some new features... ;)


                                    TOXCCT >>> GEII power

                                    [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

                                    B Offline
                                    B Offline
                                    BadKarma
                                    wrote on last edited by
                                    #24

                                    Suppose one has a working application with the following structure COrgMainFrame and COrgView loaded via a dll or unrelated part of the application. At some point in time you need to change the behaviour of one of the classes, but you are prohibitted to do this at design time time. So you can't/may not create/use CMyNewView or CMyDifferentMainFrame. The only way is to implement this is at runtime. This means override the normal behaviour of the class at runtime, by loading a new windowproc function into the message handeling part of that window you want to change. Once this is done all windows messages passes your function first instead of the PreTranslateMessage function that normaly parses the messages. So one can delete certain messages being send to the normal PreTranslateMessage function or add new functions; and altering as such the behaviour of the Original class. This doesn't have anything to do with inheritance or objects this is 'normal' windows behaviour. Each windowclass needs to be registerd in windows, this is normaly done by the MFC classes at creation of the window, this is needed to let windows now what windowproc needs to be called for this kind of window. Using the technique explained above one can alter the behaviour of one single instance of that class/window without changing the behaviour of other instances of the same object. I hope I have explained it clearly ennough what I meant. :) Like i said before I always thought that this was called subclassing in windows codito ergo sum

                                    1 Reply Last reply
                                    0
                                    Reply
                                    • Reply as topic
                                    Log in to reply
                                    • Oldest to Newest
                                    • Newest to Oldest
                                    • Most Votes


                                    • Login

                                    • Don't have an account? Register

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • World
                                    • Users
                                    • Groups