0

i've been trying to port my java code into c++ using structs or constructors but they none seem to fit for something like DEBUGNAME(id,name,description);

public enum blockInfo {

    SWIVEL("swiv1","swivel joint","A swivel joint, unpowered"),
    ARMOR("arm1","armor","A structurally sound block that protects from hits"),
    BATTERY("batt1","battery","A battery, stores energy from generators and depletes as a component draws from it");

    private string id;
    private string name;
    private string description;

    private blockInfo(string id, string name, string description)
    {
        this.id = id;
        this.name = name;
        this.description = description;
    }

}```
  • 1
    Did you search for e.g. _c++ java enum_? There are plenty answers out there already. – underscore_d Mar 12 '21 at 09:54
  • 1
    My recommendation when porting or translating code from one language to another is to not do a literal translation. Literals translations (between programming, written or spoken languages) will almost never turn out well. Instead take the underlying algorithm or design, and reimplement it using the other language. – Some programmer dude Mar 12 '21 at 09:57
  • 1
    Does this answer your question? [Difference of Enum between java and C++?](https://stackoverflow.com/questions/2080681/difference-of-enum-between-java-and-c) – Pat. ANDRIA Mar 12 '21 at 10:00

0 Answers0