标签: include

UML,包含,扩展关系

我无法理解包含和扩展关系的工作原理.假设我有一个在线购物应用程序.该应用程序允许您在未经过身份验证的情况下添加/检索购物车中的商品.这是"订单"场景:客户点击订单按钮.系统检查用户是否已通过身份验证.如果用户通过身份验证,系统将显示购买页面,否则用户将被重定向到身份验证页面.我想知道我的"身份验证"用例是否包含在"订单"用例中,如果是这样,为什么?(我问这个问题,因为如果用户已经过身份验证,则无需进行身份验证.)抱歉,我的英文

uml use-case include extend

0
推荐指数
1
解决办法
2553
查看次数

在jQuery中读取和使用CSV文件

我有以下问题:

我有一个很大的CSV文件,其中包含很多数据,我只需要使用jQuery就可以在(外部(当然,已批准!))网页上使用这些数据。

我发现jQuery-csv能够将csv数据处理到数组中。一旦我将数据存储在数组中,我就可以完成我需要做的一切。但是,我不太了解在哪里以及如何“包含” csv文件。它是托管的,可以通过url获得。jQuery-csv似乎从未链接到文件,并且它们的演示页仅显示通过页内<input>标记使用的内容。

为了进一步了解这种情况:客户希望使用带有大量句子的.csv文件数据库(“我很喜欢这个!”),并在自己的网站上随机显示这些句子。

tl; dr:如何将.csv文件加载到页面上,以便可以与jQuery-csv一起使用?

csv jquery include jquery-csv

0
推荐指数
1
解决办法
1085
查看次数

C++ #include不起作用

我试图在C++中包含这样的函数,我无法理解为什么它不起作用.我有3个文件.

test.cc

int test() {
  std::cout << "This is a test" << std::endl;
}
Run Code Online (Sandbox Code Playgroud)

test.h

int test();
Run Code Online (Sandbox Code Playgroud)

main.cc

#include "test.h"

int main() {

    test();
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

这是我得到的错误和我使用的命令.

c++ main.cc -o main
Undefined symbols for architecture x86_64:
  "test()", referenced from:
      _main in main-12ba52.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)

c++ header include

0
推荐指数
1
解决办法
7163
查看次数

C++中的重新定义,头文件中的先前定义?

所以我很困惑.尝试实现先前在头文件中声明的方法时,我收到重新定义错误.我在标题中添加了包含防护,但仍然遇到了同样的错误.如果有人能向我解释我没有看到的东西,那就太棒了.

在main.cpp包含的文件中:2:./ something.cpp:7:12:错误:重新定义'method'int Thing :: method(void)^ ./ thing.hpp:12:6:注意:之前的定义在这里int方法(void){}; ^

- 编辑 -

我现在得到以下内容:

重复符号__ZN5Thing6methodEv in:main.o thing.o ld:1个用于体系结构x86_64的重复符号

thing.hpp:

#ifndef THING_H
#define THING_H

class Thing {

public:
        int a;
        int b;
        char c;

        int method(void) {};
        Thing(int anA, int aB, char aC): a(anA), b(aB), c(aC) {};


};

#endif
Run Code Online (Sandbox Code Playgroud)

thing.cpp

#include <iostream>
#include <stdio.h>
#include "thing.hpp"

using namespace std;

int Thing::method(void)
{
        return 5;

}
Run Code Online (Sandbox Code Playgroud)

main.cpp中

#include <iostream>
#include "thing.cpp"

using namespace std;

Thing* thing = new Thing(5,5,'c');

int main(int argc, char …
Run Code Online (Sandbox Code Playgroud)

c++ header include guard redefinition

0
推荐指数
1
解决办法
3838
查看次数

如何从PHP中的其他.php文件访问数据?

我有login.phpmainpage.php文件,我想从中访问login.php用户的数据mainpage.php.

我应该使用requireinclude?如何连接这些文件?

require login.php;
include login.php;
Run Code Online (Sandbox Code Playgroud)

php data-access require include

0
推荐指数
1
解决办法
631
查看次数

C++包含并重新定义了类错误

我目前正在编写一个程序,根据不同的参数搜索歌曲.在我的系统中有两种类型的歌曲:歌词和乐器.因为我需要将它们都放在1个向量中,所以我有一个歌曲类和一个LyricsSong&InstrumentalSong子类.

所以我有一个Song.h文件:

#include <stdio.h>
#include <iostream>
#include <string>


class Song
{
public:
    std::string title;
    virtual void print();
    virtual void printSong(std::string query);
};
Run Code Online (Sandbox Code Playgroud)

还有乐器和歌词子类,它们以这种方式定义:

class LyricsSong : public Song
class InstrumentalSong : public Song
Run Code Online (Sandbox Code Playgroud)

两者都包括Song.h,在这两个类中,类只在头文件中定义.

当我尝试运行另一个使用这两个子类的文件时,包括:

#include "LyricsSong.h"
#include "InstrumentalSong.h"
Run Code Online (Sandbox Code Playgroud)

(显然更多的cpp库),我得到以下编译错误:

In file included from /cygdrive/c/Users/Username/Documents/C++ Workshop/ex2/ex2_code/InstrumentalSong.h:16:0,
                 from /cygdrive/c/Users/Username/Documents/C++ Workshop/ex2/ex2_code/songsParser.cpp:26:
/cygdrive/c/Users/Username/Documents/C++ Workshop/ex2/ex2_code/Song.h:6:7: error: redefinition of 'class Song'
 class Song
       ^
In file included from /cygdrive/c/Users/Username/Documents/C++ Workshop/ex2/ex2_code/LyricsSong.h:15:0,
                 from /cygdrive/c/Users/Username/Documents/C++ Workshop/ex2/ex2_code/songsParser.cpp:25:
/cygdrive/c/Users/Username/Documents/C++ Workshop/ex2/ex2_code/Song.h:6:7: error: previous definition of 'class Song'
 class Song
       ^
Run Code Online (Sandbox Code Playgroud)

什么时候: …

c++ polymorphism inheritance multiple-inheritance include

0
推荐指数
2
解决办法
4255
查看次数

如何使用包括直接在PHP中定义

我想在php中使用include直接定义

例如

<?php define('panel' , 'include "../panel/admin.php";'); //in a saperate php page ?>
Run Code Online (Sandbox Code Playgroud)

并包含此文件

现在我想用

<?php panel ?> //in another page

php include

0
推荐指数
1
解决办法
57
查看次数

如何在PHP中同时包含两个类文件,以便它们的方法可以在彼此之间访问?

我有以下内容:

include 'firstclass.php';
include 'secondclass.php';
Run Code Online (Sandbox Code Playgroud)

firstclass.php:

class First {
  public static function foo() {
    Second::bar();
  }
  public static function oof() {
    // ...
  }
}
Run Code Online (Sandbox Code Playgroud)

secondclass.php:

class Second {
  public static function bar() {
    First::oof();
  }
}
Run Code Online (Sandbox Code Playgroud)

可以看出,我需要从中访问Second类的方法,First反之亦然.

如何将两者都包含在一起,以便可以从彼此的类中访问它们?

php oop class include

0
推荐指数
1
解决办法
885
查看次数

ti.include的appcelerator解决方法不起作用

嗨,我已经尝试了appcelerator团队建议的解决方法(用于处理6.0.0版中对ti.include的弃用)

function include(file) {
    return eval(Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, file).read().text); 
}
Run Code Online (Sandbox Code Playgroud)

我得到一个错误,可能是系统无法读取文件。错误是:

[错误]:TiBlob:java.io.FileNotFoundException:资源/下划线-min.js

我已经设法通过.getDirectoryListing()列出了目录文件,但找不到该文件,实际上我在那里找不到任何.js文件。

有什么建议么?

filesystems include titanium appcelerator

0
推荐指数
1
解决办法
1218
查看次数

C问题包括警卫

我有一个包含防护设置的头文件.我的项目中有多个C文件,需要这个头文件进行编译.当我去编译但是我得到一个错误,说该函数已经包含在另一个文件中.包括警卫不应该阻止这种情况发生吗?从理论上讲,我相信我应该能够多次导入这个文件而没有这个问题.

#ifndef __BST_INCLUDED
#define __BST_INCLUDED__

//bunch of code here

#endif
Run Code Online (Sandbox Code Playgroud)

错误:

bst.h:22:13: error: conflicting types for ‘pruneBSTNode’
 extern void pruneBSTNode(bst *tree,bstNode *node);
             ^
In file included from vbst.h:5:0,
                 from bstrees.c:7:
Run Code Online (Sandbox Code Playgroud)

c header include-guards include

0
推荐指数
1
解决办法
258
查看次数