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. CRuntimeClass

CRuntimeClass

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 Posts 3 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.
  • N Offline
    N Offline
    NicholasCougar
    wrote on last edited by
    #1

    Hi, the symbol :: puzzles me. I already know that this is a scope resolution operator which is used to execute a parent class method from within a subclass method. Plz look here, return &class_name::class##class_name; Note: ## is used to connect two separated string. class##class_name is NOT a method, and &class_name::class##class_name in all means a pointer to a CRuntimeClass struct. There are others, COjbect::classCObject, CCmdTarget::classCCmdTarget,etc. What doest :: mean here?? :rolleyes: Best regard. I confess that I am a stubborn guy, but why not put things thoroughly, logically and systematically clean. One concrete prolem is worth a thousand unapplied abstractions.

    N 1 Reply Last reply
    0
    • N NicholasCougar

      Hi, the symbol :: puzzles me. I already know that this is a scope resolution operator which is used to execute a parent class method from within a subclass method. Plz look here, return &class_name::class##class_name; Note: ## is used to connect two separated string. class##class_name is NOT a method, and &class_name::class##class_name in all means a pointer to a CRuntimeClass struct. There are others, COjbect::classCObject, CCmdTarget::classCCmdTarget,etc. What doest :: mean here?? :rolleyes: Best regard. I confess that I am a stubborn guy, but why not put things thoroughly, logically and systematically clean. One concrete prolem is worth a thousand unapplied abstractions.

      N Offline
      N Offline
      Niklas L
      wrote on last edited by
      #2

      NicholasCougar wrote: What doest :: mean here?? It means just what you said this is a scope resolution operator In a macro, #define MYMACRO(class_name)\ class_name::class##class_name used as MYMACRO(CMyClass); evaluates to CMyClass::classCMyClass Of course, classCMyClass has to be declared in CMyClass

      J N 2 Replies Last reply
      0
      • N Niklas L

        NicholasCougar wrote: What doest :: mean here?? It means just what you said this is a scope resolution operator In a macro, #define MYMACRO(class_name)\ class_name::class##class_name used as MYMACRO(CMyClass); evaluates to CMyClass::classCMyClass Of course, classCMyClass has to be declared in CMyClass

        J Offline
        J Offline
        Jon Hulatt
        wrote on last edited by
        #3

        And you'll find the classCMyClass member is declared and defined in the DECLARE/IMPLEMENT_DYNCREATE macros. Sorry to dissapoint you all with my lack of a witty or poignant signature.

        1 Reply Last reply
        0
        • N Niklas L

          NicholasCougar wrote: What doest :: mean here?? It means just what you said this is a scope resolution operator In a macro, #define MYMACRO(class_name)\ class_name::class##class_name used as MYMACRO(CMyClass); evaluates to CMyClass::classCMyClass Of course, classCMyClass has to be declared in CMyClass

          N Offline
          N Offline
          NicholasCougar
          wrote on last edited by
          #4

          Hi, From MSDN, :: is scope resolution operator for executing METHOD declared in superclass. But classCMyClass is not a METHOD, but a STRUCT. Can :: be used in this way? Best regard. I confess that I am a stubborn guy, but why not put things thoroughly, logically and systematically clean. One concrete prolem is worth a thousand unapplied abstractions.

          N 1 Reply Last reply
          0
          • N NicholasCougar

            Hi, From MSDN, :: is scope resolution operator for executing METHOD declared in superclass. But classCMyClass is not a METHOD, but a STRUCT. Can :: be used in this way? Best regard. I confess that I am a stubborn guy, but why not put things thoroughly, logically and systematically clean. One concrete prolem is worth a thousand unapplied abstractions.

            N Offline
            N Offline
            Niklas L
            wrote on last edited by
            #5

            :: is not only used to specify superclass methods. It can be used to: Specify methods in your own class, Specify class methods (static) in any class, Resolve namespaces, Reference instance and class member variables, Specify any nested classes, structs, enums, etc. All it really does is give the location of a specific item. E.g. std::cout // specifies that cout is in the std namespace class C { enum E { num1 }; static void sfunc(); }; void func(C::E num); // specifies the type E in class C func(C::num1); // calling function with class C's enum value num1 C::sfunc(); // calling class C's static function sfunc() etc... Hope that helps.

            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