小编Jul*_*let的帖子

为什么我应该使用"using"关键字来访问我的基类方法?

我写下面的代码是为了解释我的问题.如果我注释第11行(使用关键字"using"),编译器不会编译该文件并显示以下错误:invalid conversion from 'char' to 'const char*'.它似乎没有void action(char)Parent类中看到Son类的方法.

为什么编译器会以这种方式运行?或者我做错了什么?

class Parent
{
    public:
        virtual void action( const char how ){ this->action( &how ); }
        virtual void action( const char * how ) = 0;
};

class Son : public Parent
{
    public:
        using Parent::action; // Why should i write this line?
        void action( const char * how ){ printf( "Action: %c\n", *how ); }
};

int main( int argc, char** argv ) …
Run Code Online (Sandbox Code Playgroud)

c++ oop inheritance using

66
推荐指数
4
解决办法
4万
查看次数

不使用激活的Attrib会有影响吗?

我应该在切换到使用较少(或不同位置)属性的程序着色器时禁用着色器属性吗?

我使用glEnableVertexAttribArray()/ glDisableVertexAttribArray()启用和禁用这些属性.

是否有任何性能影响,或者它是否会带来一些错误,或者启用/禁用将比激活所有属性慢并让它们激活?

c++ opengl glsl

6
推荐指数
1
解决办法
367
查看次数

标签 统计

c++ ×2

glsl ×1

inheritance ×1

oop ×1

opengl ×1

using ×1