Skip to content

Замечания по реализации адресной книги #20

@alexey-malov

Description

@alexey-malov
class CName
{
public:
    CName(std::string const & = "");
public:
    std::string GetValue() const;
    void SetValue(std::string const &);
public:
    bool operator ==(std::string const &) const;
    bool operator !=(std::string const &) const;
private:
    std::string m_data;
};

m_data - слишком абстрактное название
SetValue - почему бы не сделать оператор =, принимающий std::string, а вместо GetValue - оператор const std::string&

Оператор == использовать для приблизительного сравнения неправильно. а то Иван Иванов == Иван, Лучше сделать метод bool Match(const std::string & name)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions