c++ - qt中命令类的实现
PHP中文网
PHP中文网 2017-04-17 11:17:02
0
1
572

项目是基于QT开发,项目需要对一些字符串命令进行比较,因此我打算封装一个东西,它包含我可以用到的所有字符串命令,最好是一个单独的类,我以前了解Java中可以封装一个类,包含静态对象,可以用:
类名.对象名 的方式使用
但换到qt我有些疑惑了,求教,谢谢。

PHP中文网
PHP中文网

认证0级讲师

reply all(1)
PHPzhong

After testing, the method is now written down:
First, you need to create a class, which can inherit the QObject class or not. It is just a class. The creation method can be manual or you can use the menu of the development environment. I take the Command class as an example here.

After modification:
command.h

#ifndef COMMAND_H
#define COMMAND_H
#include <QString>
class Command
{
public:
    const static QString TEMP;
};
#endif // COMMAND_H

command.cpp

#include "command.h"
const QString Command::TEMP="fuck the world";
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template