2
Answers

3 classes how it should be configure

Magda Sztorc

Magda Sztorc

16y
2.2k
1
Hello,

I created 3 classes: Person, Telephon, Card

the Cart class contain Person class and person class contain Telephon class.

My question is if it's correct or mabye the class telephon should be include directly in Card class? What is the better solution?

    public class Person
 {
        private string firstName;
        private string lastName;

        private Telephon telephonNumber= new Telephon();

        public string FirstName
        {
            get { return firstName; }
            set { firstName = value; }
        }

        public string LastName
        {
            get { return lastName; }
            set { lastName= value; }
        }

        public void setTelephon(string telephon)
        {
            telephonNumber.TelephonNumber = telephon;
       }

    public class Card
    {
       
        private Person osob = new Person ();

        public void AddPerson(string firstName, string secondName, string telephon){

            osob.FirstName= firstName;
            osob.SecondName= secondName;
            osob.setTelephon = telephon;
        }

    public class Telephon
    {
        public int numer;

        public string nrTelefonu
        {
            get{ return numer; }
            set{ numer= value; }
        }

Answers (2)
Next Recommended Forum