English 中文(简体)
将KanjiCard*改为非标准类别KanjiCard(斜体)
原标题:conversion from KanjiCard* to non-scalar type KanjiCard requested (custom enum)

奥凯,我曾尝试利用谷歌-sen塞,并在这个网站上进行搜索。 虽然我已经发现许多关于这一错误的岗位,但我发现有过任何处理过的问题。 而且,我所看到的所有东西都不是有人试图将一种类型转让给另一个类别,不适当地使用新的等等。 就我所知,本案的情况并非如此。

如标题所述,Im在试图汇编使用g++的Im方案时,从KanjiCard*向非Scalar型KanjiCard申请。

我有一个名为KanjiCard的班子,具有这一公开定义:

enum KanjiCardType {
    KANJI_CARD = 1,
    KEYWORD_CARD = 2
};

班级的施工者的定义如下:

    KanjiCard(char *cardText, int cardTextLength, int cardWidth, int cardHeight,
        int cardX, int cardY, KanjiCardType cardType, SDL_Color textColor);

(如果使用果园*,而不是 st脚.:由于使用这种方式更容易与Im图书馆合作。)

I m calling it to create new cards like so (this is where the error comes up):

KanjiCard currentCard = new KanjiCard(kanji_line, strlen(kanji_line), 
    CARD_WIDTH, CARD_HEIGHT, xPos, yPos, cardType, textColor);

www.un.org/Depts/DGACM/index_spanish.htm 类型 类型=KanjiCard:KANJI_CARD;

我最初试图通过<代码>。 KanjiCard:KANJI_CARD www.un.org/Depts/DGACM/index_spanish.htm 类型现为“构造者”称呼号,但我想到的是,我正在尝试一切可能想尝试和工作,包括试图将“射线”标/标/代码”参数从构造者改为“条码”*卡塔佩和<代码>和>p>;卡塔佩和电灯片,同时在电线上使用<密码>。

As far as I can tell, cardType isn t a pointer, so I really can t figure out why I m getting that message. Any help would be greatly appreciated, as I m at my wit s end trying to figure this out.

<><>Edit>: 我还要提到,我还试图将大体从这几类人中删除(并删除<条码>KanjiCard:当然是前言),并且仍然有同样的问题。

最佳回答

它没有cardType,说明问题;它有<编码> 现行Card/code>。 你写道:

KanjiCard currentCard = new KanjiCard(...

That s assigning a pointer to a non-pointer type. You may have meant this:

KanjiCard *currentCard = new KanjiCard(...

......或您可能已表示:

KanjiCard currentCard(...

我以前的建议将分配一个<代码>KanjiCard。 <代码>当前Card将指<编码>KanjiCard。 后者将分拨。 www.un.org/chinese/ga/president

前者必须人工操作<代码>delete。 后者不需要成为<条码>指南>。

前者可使用<代码>->。 后者可使用<代码>。

问题回答

......

KanjiCard currentCard = KanjiCard(
    kanji_line, strlen(kanji_line), CARD_WIDTH, CARD_HEIGHT, xPos, yPos, cardType, textCol或
    );

KanjiCard currentCard(
    kanji_line, strlen(kanji_line), CARD_WIDTH, CARD_HEIGHT, xPos, yPos, cardType, textCol或
    );

The first is called copy initialization, and the second is called direct initialization.

注:此处没有<代码>新

Cheers & hth.,





相关问题
Finding the Highest Value in an Enumeration

I m writing a method which determines the highest value in a .NET enumeration so I can create a BitArray with one bit for each enum value: pressedKeys = new BitArray(highestValueInEnum<Keys>());...

Conversion of Enum to Enumerable

To convert Enum to Enumerable ,I use public enum Flags { Trivial=1, Minor, Major, Critical } IEnumerable<int> n = Enumerable.Range((int)Flags.Trivial, (...

Subclass check, is operator or enum check

A couple of friends was discussing the use of inheritance and how to check if a subclass is of a specific type and we decided to post it here on Stack. The debate was about if you should implement a ...

Enum scoping issues

I try to keep things as local as possible, so I put enums at class scope, even if they are shared between two classes (I put it in the class that "goes better" with it.) This has worked out great, but ...

How do I sort enum members alphabetically in Java?

I have an enum class like the following: public enum Letter { OMEGA_LETTER("Omega"), GAMMA_LETTER("Gamma"), BETA_LETTER("Beta"), ALPHA_LETTER("Alpha"), private final String ...

C++ enum value initialization

I have an enum declared in my code as: enum REMOTE_CONN { REMOTE_CONN_DEFAULT = 0, REMOTE_CONN_EX_MAN = 10000, REMOTE_CONN_SD_ANNOUNCE, REMOTE_CONN_SD_IO, REMOTE_CONN_AL, ...

WCF: Enforce equal DataContracts on both sides

I m wondering if it is possible to have WCF make sure that the DataContracts on both sides of a connection are exactly the same (and throw an exception when trying to connect if they are not). For ...

热门标签