phone_number: ...
This commit is contained in:
parent
86f77239eb
commit
c5ea194574
2 changed files with 44 additions and 0 deletions
26
cpp/phone-number/phone_number.cpp
Normal file
26
cpp/phone-number/phone_number.cpp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#include "phone_number.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <ctype>
|
||||
|
||||
using namespace std;
|
||||
|
||||
phone_number::phone_number(const string &str)
|
||||
{
|
||||
static const string invalid_number = "0000000000";
|
||||
}
|
||||
|
||||
string phone_number::number() const
|
||||
{
|
||||
return number_;
|
||||
}
|
||||
|
||||
string phone_number::area_code() const
|
||||
{
|
||||
return area_code_;
|
||||
}
|
||||
|
||||
phone_number::operator string() const
|
||||
{
|
||||
return number_;
|
||||
}
|
||||
18
cpp/phone-number/phone_number.h
Normal file
18
cpp/phone-number/phone_number.h
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
class phone_number
|
||||
{
|
||||
std::string area_code_;
|
||||
std::string number_;
|
||||
|
||||
public:
|
||||
|
||||
phone_number(const std::string&);
|
||||
|
||||
std::string number() const;
|
||||
std::string area_code() const;
|
||||
|
||||
operator std::string() const;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue