b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

printf()函数 [转]linux调用动态库so文件(8)

电脑杂谈  发布时间:2018-12-25 20:13:11  来源:网络整理

test_2.cpp中定义继承类test2,并实现虚函数virtual void display()const的定义,并实现一个创建类函数和一个销毁类指针函数。

main.cpp中实现动态的调用不同库中的display()方法。

1: #include 2: #include 3: #include 4: 5: 6: using namespace cv。

近期染色体为中心的hpp计划(chromosome-centrichumanproteomeproject,c-hpp)及基于人体组织的hpp图谱(tissue-basedmapofhumanproteome)已取得一定进展。

test_base.hpp中定义一个含有纯虚函数virtualvoid display() const = 0的基类。

#include"test_base.hpp"。

#ifndef TEST_BASE_HPP

#define TEST_BASE_HPP

#include

using namespace std;

class test_base {

public:

test_base(){}

virtual~test_base() {}

voidcall_base() {

cout << "call base" << endl;

}

virtual voiddisplay() const = 0 ;

};

// the types of the class factories

typedef test_base* create_t();

typedef void destroy_t(test_base*);

#endif

g++ test1.cpp -otest1。

7.将test1.cpp中的内容替换为以下代码:。

add_executable (project_namemain.cpp test1.cpp test2.cpp)。

一个test1.cpp文件。

#include "test_base.hpp"

class test1 : public test_base {

public:

virtual voiddisplay() const {

cout << "Running in test1.so Now" << endl;

}

};

// the class factories

extern "C" test_base* create() {

return newtest1;

}

extern "C" void destroy(test_base* p) {

deletep;

}

////////////////////////////////test1.cpp//////////////////////////////////////////////////////

#include "test_base.hpp"

class test2 : public test_base {

public:

virtual voiddisplay() const {

cout << "Running in test2.so Now" << endl;

}

};

// the class factories

extern "C" test_base* create() {

return newtest2;

}

extern "C" void destroy(test_base* p) {


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/ruanjian/article-90978-8.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    热点图片
    拼命载入中...