我是c ++的新手.当我尝试编译下面的代码时,我收到此错误
constructor for 'child' must explicitly initialize the
base class 'parent' which does not have a default constructor
child::child(int a) {
这是我的课
#include<iostream>
using namespace std;
class Parent
{
public :
int x;
Parent(int a);
int getX();
};
Parent::Parent(int a)
{
x = a;
}
int Parent::getX()
{
return x;
}
class Child : public Parent
{
public:
Child(int a);
};
Child::Child(int a)
{
x = a;
}
int main(int n , char *argv[])
{
}
Run Code Online (Sandbox Code Playgroud)
为什么我收到此错误?我该如何解决?提前致谢
我正在开发中NDK.它挂起来了Galaxy S3.为了测试,我投入android:largeheap = "true"了Manifest.然后没有悬而未决的问题.这是一个好用的做法largeHeap="true"吗?
由于此标记,Google是否有机会拒绝我的版本?如何在不使用的情况下阻止我的应用挂起largeheap="true"?
有人请解释LOCAL_EXPORT_C_INCLUDES和LOCAL_C_INCLUDESandroid 之间有什么区别mk file.
我想暂停执行c ++程序5秒钟.在Android Handler.postDelayed具有我想要的功能.有没有类似于c ++的东西?
我有一个模板类.
template <class A> class TemplateClass
{
//functions
}
Run Code Online (Sandbox Code Playgroud)
我有以下课程
class B : A
{
//functions
}
class C : A
{
//functions
}
Run Code Online (Sandbox Code Playgroud)
我怀疑为什么不可能定义如下:
TemplateClass<A> *instance;
instance = new TemplateClass<B>; // A is the super class of B
Run Code Online (Sandbox Code Playgroud)
提前致谢
我正在尝试在Ubuntu 14的Codeblocks IDE中构建Cocos2d-x项目fontconfig/fontconfig.h。编译时未发现错误。我被困在这里。我该如何解决?