Create a class Phone with four fields: a name of the owner, a code of the country, a code of the city and a phone number. In c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Create a class Phone with four fields: a name of the owner, a code of the country, a code of the city and a phone number. In c++

c++

11th Dec 2017, 4:08 PM
Maira
Maira - avatar
6 Answers
+ 10
class Phone { private string owner; private int codeOfCountry; private int codeOfCity; private string phoneNumber; public Phone(string owner, int code1, int code2, string number) { this.owner = owner; codeOfCountry = code1; codeOfCity = code2; phoneNumber = number; } }
11th Dec 2017, 7:28 PM
Vukan
Vukan - avatar
+ 3
if we enter the first digit of phone number ,this code output the people
12th Dec 2017, 4:05 AM
Maira
Maira - avatar
+ 2
that's very simple using function it will be more easier to use like "Constructor".
11th Dec 2017, 4:23 PM
🦋FEATHER🦋
🦋FEATHER🦋 - avatar
+ 2
really awesome at C++🙏
24th Dec 2017, 2:44 PM
Abhishek Raj
Abhishek Raj - avatar
+ 1
thanks 😘
12th Dec 2017, 2:00 AM
Maira
Maira - avatar
+ 1
you are awesome at challenges maria
23rd Dec 2017, 2:56 AM
Abhishek Raj
Abhishek Raj - avatar