jkl0619
jkl0619

Reputation: 37

Expression must have class type

I am assuming this has something to do with the pointer, but here is my code that is having the error. Obviously I am not done yet, but the error is with the keys in the code below.

bool LCR_cipher::iskeysOK()
{
    vector<char> v(keys.begin(), keys.end());
    std::transform(v[0].begin(), v[0].end(), v[0].begin(), ::tolower);
}

Here is the header file

class LCR_cipher
{
public:
    // Constructor:
    LCR_cipher(char *context_string, char *keys_string);
    // Destructor: deallocate memory that was allocated dynamically
    ~LCR_cipher();
    //check whether *keys string has valid LCR encryption value
    bool iskeysOK();
    //encrypt context string
    void encryption();
    //unencrypt context string (optional)
    void unencryption();
    //check whether the context string is encrypted or not
    bool isencrypted();
    //Retrieve CLR encryption value from *keys string
    void getkeys(int& a, int& c);
    // output the *context to console
    void output_context();
private:
    char *context; //array to store context string
    char *keys; //array to store encryption keys
    bool encrypted; //whether string in *context is encrypted or not
    int context_MaxSize;
    int context_CurrentSize;
    int keys_MaxSize;
    int keys_CurrentSize;

}

Where did I go wrong here?

Upvotes: 0

Views: 1171

Answers (1)

user2100815
user2100815

Reputation:

Here:

  v[0].begin()

v is a vector of char, so v[0] is a char, and chars don't have methods.

Upvotes: 3

Related Questions