So what is the problem?
class Pet {
public:
Pet();
};
class Cat : public Pet {
public:
Cat(const std::string &str) : Pet(), _ver(str){ }
private:
std::string _ver;
};
class Pet {
public:
Pet();
};
class Cat : public Pet {
public:
Cat(const std::string &str) : Pet(), _ver(str){ }
private:
std::string _ver;
};
To copy to clipboard, switch view to plain text mode
or if you don't want to use std::string:
class Cat : public Pet {
public:
Cat(const std::string &str) : Pet(), _ver(strdup(str)){ }
~Cat(){ free(_ver); }
private:
char *_ver;
};
class Cat : public Pet {
public:
Cat(const std::string &str) : Pet(), _ver(strdup(str)){ }
~Cat(){ free(_ver); }
private:
char *_ver;
};
To copy to clipboard, switch view to plain text mode
Bookmarks