小编Tim*_*Tim的帖子

bipush 在 JVM 中是如何工作的?

我知道 iload 接受整数 -1 到 5,但是如何使用 bipush 指令扩展到更高的数字?特定整数如何与字节码一起存储?

java jvm jvm-bytecode

5
推荐指数
2
解决办法
4130
查看次数

C++不能使用从基类继承的getter函数

我可以Vehicle::colorSedan类中访问的唯一方法是重新实现getter方法.我想从子类访问它,而不这样做.

// Base Class
class Vehicle
{
protected:
    bool windowIsOpen[4];
    int  wheels;
    char *color;

public:
Vehicle(char *color) : color(color){};
char *getColor() { return color; }
};

class Sedan : Vehicle
{
public:
    Sedan(char* color) : Vehicle(color) {}
};

int main(int argc, char **argv){
    Sedan se("green");
    cout<<se.getColor()<<endl;
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

c++ oop inheritance

3
推荐指数
1
解决办法
260
查看次数

标签 统计

c++ ×1

inheritance ×1

java ×1

jvm ×1

jvm-bytecode ×1

oop ×1