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 7518105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:39:39+00:00 2026-05-30T01:39:39+00:00

I am having some issues regarding inheritance. I have a class of Person, and

  • 0

I am having some issues regarding inheritance. I have a class of Person, and a class of Student:Person, Employee:Person. The errors that I am getting baffle me – I do not understand why I am getting them. I used tiny paste to paste the code as I thought it would take too much space up here. If I should post question elsewhere, let me know. Thanks.

Code Files:

  • main.cpp – http://tinypaste.com/0775bea3
  • Person.h – http://tinypaste.com/657638ef
  • Person.cpp – http://tinypaste.com/934ee106
  • Student.h – http://tinypaste.com/260fa4bb
  • Student.cpp – http://tinypaste.com/b6259aa4
  • Employee.h – http://tinypaste.com/f8b53d36
  • Employee.cpp – http://tinypaste.com/1d939927

Here are the errors that I am getting:

1>------ Build started: Project: PR4_Students, Configuration: Debug Win32 ------
1>Build started 2/18/2012 11:14:27 PM.
1>InitializeBuildStatus:
1>  Touching "Debug\PR4_Students.unsuccessfulbuild".
1>ClCompile:
1>  main.cpp
1>\\cs1\cs_students\mlindahl15\cs273\pr4_students\student.h(15): error C2969: syntax error : ';' : expected member function definition to end with '}'
1>\\cs1\cs_students\mlindahl15\cs273\pr4_students\student.h(16): error C2059: syntax error : 'inline function header'
1>\\cs1\cs_students\mlindahl15\cs273\pr4_students\student.h(16): error C2630: ';' found in what should be a comma-separated list
1>\\cs1\cs_students\mlindahl15\cs273\pr4_students\employee.h(15): error C2969: syntax error : ';' : expected member function definition to end with '}'
1>\\cs1\cs_students\mlindahl15\cs273\pr4_students\employee.h(16): error C2059: syntax error : 'inline function header'
1>\\cs1\cs_students\mlindahl15\cs273\pr4_students\employee.h(16): error C2630: ';' found in what should be a comma-separated list
1>  Student.cpp
1>\\cs1\cs_students\mlindahl15\cs273\pr4_students\student.h(15): error C2969: syntax error : ';' : expected member function definition to end with '}'
1>\\cs1\cs_students\mlindahl15\cs273\pr4_students\student.h(16): error C2059: syntax error : 'inline function header'
1>\\cs1\cs_students\mlindahl15\cs273\pr4_students\student.h(16): error C2630: ';' found in what should be a comma-separated list
1>\\cs1\cs_students\mlindahl15\cs273\pr4_students\student.cpp(8): error C2084: function 'Student::Student(void)' already has a body
1>          \\cs1\cs_students\mlindahl15\cs273\pr4_students\student.h(15) : see previous definition of '{ctor}'
1>  Employee.cpp
1>\\cs1\cs_students\mlindahl15\cs273\pr4_students\employee.h(15): error C2969: syntax error : ';' : expected member function definition to end with '}'
1>\\cs1\cs_students\mlindahl15\cs273\pr4_students\employee.h(16): error C2059: syntax error : 'inline function header'
1>\\cs1\cs_students\mlindahl15\cs273\pr4_students\employee.h(16): error C2630: ';' found in what should be a comma-separated list
1>\\cs1\cs_students\mlindahl15\cs273\pr4_students\employee.cpp(8): error C2084: function 'Employee::Employee(void)' already has a body
1>          \\cs1\cs_students\mlindahl15\cs273\pr4_students\employee.h(15) : see previous definition of '{ctor}'
1>  Generating Code...
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:05.64
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
  • 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-30T01:39:40+00:00Added an answer on May 30, 2026 at 1:39 am

    I didn’t analyze the whole code, but you seem to be confused how to declare calls to the base class constructor;

    class Student : public Person
    {
    ...
        Student() : Person();
    ...
    };
    

    The call to the base class constructor should be done on the actual implementation of the constructor only. Since you already do that with

    Student::Student() : Person() {
    

    you can just change the declaration to

    class Student : public Person
    {
    ...
        Student();
    ...
    };
    

    and things should turn out better.

    Edit: Adding the answer to a follow-up question below;

    The line

    Employee(string department, string jobTitle, int yearOfHire) 
      : Person(name, socialSecurityNumber, age, gender, address, phoneNumber) {
    

    does for the same reason not really make sense. If you want to be able to construct an Employee with all those parameters, you need to instead declare the constructor as;

    Employee(string department, string jobTitle, int yearOfHire, name, 
             socialSecurityNumber, age, gender, address, phoneNumber) {
    

    and implement it as

    Employee::Employee(string department, string jobTitle, int yearOfHire, name, 
             socialSecurityNumber, age, gender, address, phoneNumber) 
      : Person(name, socialSecurityNumber, age, gender, address, phoneNumber) {
    

    thus passing on the parameters to the base class constructor.

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

Sidebar

Related Questions

Recently I was having some issues with a singelton class that was lazy initializing
Having some issues getting my head around the differences between UTF-8, UTF-16, ASCII and
I'm having some issues to deserialize a Json array that follows this format: [
I am having some issues with a code that is occasionally and sporadically throwing
I'm having some issues getting file uploads to work correctly and the following code
I'm having an issue understanding some compiler-errors, regarding 2D arrays (ArrayList containing an ArrayList)
I'm having some issues with std::cout, std::stringstream, and std::string.c_str(). Mainly, it seems that there's
I'm building a monitor app and am having some threading issues. I have, using
Regarding the Castle Automatic Transaction Management Facility; I'm having some difficulties getting operations to
We have been having a lot of internal debate regarding staging tables. Some are

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.