Class 从其他命名空间创建派生类
我需要这样做才能通过我的一个主题。这是代码,我的问题是在PDA::class PDA_ipari:public PDA_basic中,我需要创建一个名称空间,其中包含来自其他名称空间的派生类。你能帮我吗Class 从其他命名空间创建派生类,class,namespaces,derived,Class,Namespaces,Derived,我需要这样做才能通过我的一个主题。这是代码,我的问题是在PDA::class PDA_ipari:public PDA_basic中,我需要创建一个名称空间,其中包含来自其他名称空间的派生类。你能帮我吗 #include <iostream> using namespace std; namespace PDA{ class pda_basic{ private : float cpu_ghz; int cpu_core; int memory;
#include <iostream>
using namespace std;
namespace PDA{
class pda_basic{
private :
float cpu_ghz;
int cpu_core;
int memory;
int storage;
public :
float getGhz()
{
return cpu_ghz;
}
void setGhz(float m)
{
cpu_ghz=m;
}
int getCore()
{
return cpu_core;
}
void setCore(int m)
{
cpu_core=m;
}
int getMemory()
{
return memory;
}
void setMemory(int m)
{
memory=m;
}
int getStorage()
{
return storage;
}
void setStorage(int m)
{
storage=m;
}
};
}
namespace abtu9p_pda{
PDA::class pda_ipari : public pda_basic {
private:
float display;
string vonalkodTipus;
int ip_vedelem;
public:
float getDisplay()
{
return display;
}
void setDisplay(float m)
{
display=m;
}
string getVonalkod()
{
return vonalkodTipus;
}
void setVonalkod(string m)
{
vonalkodTipus=m;
}
int getIP()
{
return ip_vedelem;
}
void setIP(int m)
{
ip_vedelem=m;
}
};
}
int main()
{
PDA::pda_basic tablet;
tablet.setGhz(2.7);
cout <<tablet.getGhz()<<endl;
return 0;
}
#包括
使用名称空间std;
命名空间PDA{
基本类{
私人:
浮点cpu_ghz;
int cpu_内核;
内部存储器;
int存储;
公众:
浮点getGhz()
{
返回cpu_ghz;
}
无效设置GHz(浮动m)
{
cpu_ghz=m;
}
int getCore()
{
返回cpu_核;
}
void setCore(int m)
{
cpu_核=m;
}
int getMemory()
{
返回存储器;
}
无效设置内存(int m)
{
内存=m;
}
int getStorage()
{
返回存储;
}
空隙设置存储(整数m)
{
存储=m;
}
};
}
名称空间abtu9p_pda{
PDA::类PDA\U ipari:公共PDA\U基本{
私人:
浮动显示;
线状vonalkodTipus;
int ip_vedelem;
公众:
float getDisplay()
{
返回显示;
}
无效设置显示(浮动m)
{
显示=m;
}
字符串getVonalkod()
{
返回vonalkodTipus;
}
void setVonalkod(字符串m)
{
vonalkodTipus=m;
}
int getIP()
{
返回ip_vedelem;
}
无效设置IP(整数m)
{
ip_vedelem=m;
}
};
}
int main()
{
PDA::PDA_基本平板电脑;
片剂。setGhz(2.7);
库特