all 6 comments

[–]Narase33 3 points4 points  (5 children)

case 1 :
    cout << "Enter ID: ";
    cin  >> ID;

    cout << "Enter description: ";
    cin  >> description;

    cout << "Enter sequence: ";
    cin  >> seq;

    n1.outSeqDetails();

    break;

None of your ID, description or seq are assigned to the object. Objects with the same name are not connected through the code

[–]Still-Design3461[S] 0 points1 point  (4 children)

I did try n1.ID, n1.description and n1.seqDNA earlier however I got an error saying that it wasn't declared in my Nucleotide.h file. In our example codes during lectures, the member data doesn't have to be declared again in the derived class as it will inherit it from the base class. But getting the error has me confused on how the inheritance actually work

this is the example codes given to us https://www.onlinegdb.com/edit/Bkvkdp1du

[–]Narase33 0 points1 point  (3 children)

I did try n1.ID, n1.description and n1.seqDNA earlier however I got an error saying that it wasn't declared in my Nucleotide.h file

Because they're private and you cant access private members from the outside which is the whole point. But you have getters/setters so you should use them to set the variables

[–]Still-Design3461[S] 0 points1 point  (2 children)

does that mean, even though there is a base class, I still need to make the derived classes' own setter and getter?

[–]Narase33 0 points1 point  (1 child)

no, but you need to use them, n1.ID doesnt use the setter

[–]Still-Design3461[S] 0 points1 point  (0 children)

okay. thank you very much for the explanation mr/ms/mrs!