SUPER:: - must be a class or namespace name..



  • On 10/06/2013 at 10:38, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:    
    Platform:      
    Language(s) :

    ---------
    Hi, some plugins use this:

    return SUPER::BlaBla_foo(x, y, z);
    

    the hashmap.h uses this:

    Super::ConstIterator::operator++();
    

    but I can't. I get "name followed by '::' must be a class or namespace name"

    I do use this:

    ObjectAncestor::BlaBla_foo(x, y, z);
    

    but I wonder how other can use SUPER / Super and to what extent it has any purpose / is better than just using the name of the ancestor.



  • On 10/06/2013 at 10:41, xxxxxxxx wrote:

    SUPER is coming from this macro.
    You can use it only if you have INSTANCEOF(Object,ObjectAncestor) in you class.

      
        
        
        	#define INSTANCEOF(X,Y)                  \n    		public:                                \n    			typedef Y SUPER;                     \n    		private:
    

    > but I wonder how other can use SUPER / Super and to what extent it has any purpose / is better than just using the name of the ancestor.

    Actually it is the same, just using some macro magic.



  • On 10/06/2013 at 10:55, xxxxxxxx wrote:

    Thanks a lot!
    I will stick to my usual way of doing things then.
    In C# there is something called "Base" which is intrinsic so to say.



  • On 11/06/2013 at 03:16, xxxxxxxx wrote:

    I suggest you to just use

    class MyClass : public BaseClass {
      
    public:
      
        typedef BaseClass SUPER;
      
    };
    

    instead. The INSTANCEOF macro is in my eyes nothing but confusing. I've also
    never need to have it public, so you can usually skip that as well.



  • On 11/06/2013 at 04:49, xxxxxxxx wrote:

    Why not use Super instate like hashmap?
    Or even Base like in C# then ?  :)

      
        
        
        class MyClass : public BaseClass {
        
          
        
        
        public:
        
            typedef BaseClass Super;  
            typedef BaseClass Base;  
        
        
        };
      
    


  • On 11/06/2013 at 05:11, xxxxxxxx wrote:

    Personally, I use the lower-case "super" (like Python, Java)



  • On 11/06/2013 at 08:26, xxxxxxxx wrote:

    Yep, that's also my default typedef.

    typedef BaseClass Base;
    

Log in to reply