Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6334847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:44:16+00:00 2026-05-24T18:44:16+00:00

I also have a question about how to make a copy constructor between the

  • 0

I also have a question about how to make a copy constructor between the two classes.

> person(const person& a) : name(a.getName()), address(a.getAddress()),
> schoolname(a.getSchoolname()), ssn(a.getSsn()),
> idnumber(a.getIdnumber())
>         {
> 
>         }
> 
>         person& operator =(const person& b);

that is my constructor attempt? did I fail miserably?

Thank You!

Header

#ifndef person_h
#define person_h

#include <string>
using namespace std;

    class person
    {


    public:
        person();
        person(const person& a) : name(a.getName()), address(a.getAddress()), schoolname(a.getSchoolname()), ssn(a.getSsn()), idnumber(a.getIdnumber())
        {

        }

        person& operator =(const person& b);

        person(string theName, string theAddress, string theSchoolname, string theSsn, double theIdnumber);
        string getName() const;
        void setName(string newName);
        string getSchoolname()const;
        void setSchoolname(string newSchoolname);
        string getAddress() const;
        void setAddress(string newAddress);
        string getSsn() const;
        void setSsn(string newSsn);
        double getIdnumber()const;
        void setIdnumber(double newIdnumber);
        ~person();
    protected:
        string name;
        string address;
        string schoolname;
        string ssn;
        double idnumber;
    };

impliment

#include "person.h"
#include <string>
#include <iostream>
using std::string;
using std::cout;


    person::person() : name("no name yet"), address("no address yet"), schoolname("no school name"), ssn("no number") , idnumber(0)
    {

    }



    person :: person(string theName, string theAddress, string theSchoolname, string theSsn, double theIdnumber): name(theName), address(theAddress), schoolname(theSchoolname), ssn(theSsn), idnumber(0)
    {

    }





    string person :: getName() const
    {
        return name;

    }
    string person :: getAddress() const
    {
        return address;
    }
    string person :: getSchoolname() const
    {
        return schoolname;

    }

    string person ::getSsn()const
    {
        return ssn;
    }

    double person :: getIdnumber() const
    {
        return idnumber;
    }

    void person :: setName(string newName)
    {
        name = newName;

    }
    void person :: setAddress(string newAddress)
    {
        address = newAddress;
    }
    void person :: setSchoolname( string newSchoolname)
    {
        schoolname = newSchoolname;

    }

    void person ::setSsn(string newSsn)
    {
        ssn =  newSsn;
    }

    void person ::setIdnumber( double newIdnumber)
    {
        idnumber = newIdnumber;
    }

Derived Class Header

#ifndef student_h
#define student_h

#include "person.h"
#include <string>

class student : public person
{
public:
    student();
    student(student const& s);

    student( double theStudentid, string theGpa, string theCounselor, string theMajor, string theGraduatingclass );

    double getStudentid() const;
    void setStudentid(double newStudentid);

    string getGpa()const;
    void setGpa(string newGpa);

    string getCounselor() const;
    void setCounselor(string newCounselor);

    string getMajor() const;
    void setMajor(string newMajor);

    string getGraduatingclass() const;
    void setGraduatingclass(string newGraduatingclass);

    void readClasses();
    void printTranscript();
    void addClass(string , string , string );

protected: 
    double studentid;
    string gpa;
    string counselor; 
    string major;
    string graduatingclass;
    string classes[40];
    string transcript[40];
    string Class[100];
    char array[100];
    int counter;
};

#endif

Impliment

#include "student.h"
#include <string>
using namespace std;



    student::student() : gpa("none"), counselor("none"), major("none"), graduatingclass("none"), studentid(0)
    {

    }

    student :: student ( double theStudentid, string theGpa, string theCounselor, string theMajor, string theGraduatingclass):  studentid(0), gpa(theGpa), counselor(theCounselor), major(theMajor), graduatingclass(theGraduatingclass)
    {

    }


    double student :: getStudentid() const
    {
        return studentid;
    }
    string student :: getGpa() const
    {
        return gpa;
    }
    string student :: getCounselor() const
    {
        return counselor;
    }
    string student :: getMajor() const
    {
        return major;
    }
    string student :: getGraduatingclass() const
    {
        return graduatingclass;

    }

    void student :: setStudentid(double newStudentid)
    {
        studentid = newStudentid;
    }

    void student :: setGpa(string newGpa)
    {
        gpa = newGpa;
    }
    void student :: setCounselor(string newCounselor)
    {
        counselor = newCounselor;
    }

    void student :: setMajor(string newMajor)
    {
        major = newMajor;

    }


    void student :: setGraduatingclass(string newGraduatingclass)
    {
        graduatingclass = newGraduatingclass;
    }

Main.cpp

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T18:44:19+00:00Added an answer on May 24, 2026 at 6:44 pm

    Undefined symbols for architecture x86_64: “person::~person()”,
    referenced from: student::~student() in main.o student::student() in
    student.o student::student(double, std::string, std::string,
    std::string, std::string) in student.o

    According to the linker error, you’re missing a definition of person::~person(), the person‘s destructor. In your class declaration header file, you have:

    class person
    {
    public:
        // ...
        person();
        ~person();
        // ...
    };
    

    But in your implementation file, you have:

    // ...
    person::person() {}
    // Where's person::~person() {} ?
    // ...
    

    Add a definition of person::~person() and it should resolve the above error, at least.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a question about a XNA game I'm making, but it is also
I've got a question about updating attributes. I have an user model and also
i have a question about generating images at runtime which are also links. Ok,
I have started reading C++ and I have a question about classes and member
I have downloaded sample code from Apple Center.I also have gone through following question:
EDIT: I also have access to ESXLT functions. I have two node sets of
I have a question about MVC. Particularly about models. Suppose that I have a
I have a question about unit testing. Say I have a controller with one
I still have a question about Enumerations. Here's a quick sketch of the situation.
I'm currently making a pacman game in java. I have a question about the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.