0

These are the errors the compiler is giving me on these lines od code - any help understanding or fixing this issue ????

\extpersontype.h(35) : error C3646: 'extPersonType' : unknown override specifier
\extpersontype.h(37) : error C2091: function returns function
\extpersontype.h(44) : fatal error C1903: unable to recover from previous error(s); stopping compilation

35.    extPersonType (string = "", string = "", int = 1, int = 1, int = 1900,
36.	              string = "", string = "", string = "", int = 0,
37.				  string = "", string = "");
38.private:
39.	personType person;
40.	dateType birthDate;
41.	addressType myAddress;
42.	string association;
43.	string phone;
44.};
45.#endif
4
Contributors
9
Replies
10
Views
6 Years
Discussion Span
Last Post by Moschops
0
extPersonType (string = "", string = "", int = 1, int = 1, int = 1900, string = "", string = "", string = "", int = 0, string = "", string = "");

What are you trying to do with this line of code?

0

It is supposed to hold the firstName,lastName,birthday 00-00-000, street, city,state,zip, phone#,group...

0

Please post a complete program that exhibits the problem. If you think the current complete program is too large, remove stuff (without losing the error) until it's small enough to post.

0

As Narue says, lets see the whole header file. Looks to me like you're trying to define a class and that line is an attempt to make a default constructor; something like

extPersonType::extPersonType(){
  person = " ";
  birthDate.day = 1;
  ...
  ...

and so on.

Edited by Moschops: n/a

0

Why not just make a function out of it? like enter address, cin >> address, enter name, cin >> name and stuff like that???

0

This is my personType.h file

#ifndef H_personType
#define H_personType

#include <iostream>
#include <string>

using namespace std;

class personType
{
public:
    void print() const;
      //Function to output the first name and last name
      //in the form firstName lastName.
  
    void setFirstName(string myFirstName);
      //Function to set firstName 
      //Postcondition: firstName = first;

    void setLastName(string myLastName);
      //Function to set lastName 
      //Postcondition: lastName = last;

    string getFirstName() const;
      //Function to return the first name.
      //Postcondition: The value of firstName is returned.

    string getLastName() const;
      //Function to return the last name.
      //Postcondition: The value of lastName is returned.

    personType();
      //Default constructor
      //Sets firstName and lastName to null strings.
      //Postcondition: firstName = ""; lastName = "";

    personType(string = "", string ="");
      //Constructor with parameters.
      //Sets firstName and lastName according to the parameters.
      //Postcondition: firstName = first; lastName = last;  

private:
    string firstName; //variable to store the first name
    string lastName;  //variable to store the last name
};

#endif

And this is the extPersonType.h file

#ifndef H_extPersonType
#define H_extPersonType

#include <iostream>
#include <string>
#include "addressType.h"
#include "personType.h"
#include "dateType.h"

using namespace std;

class extPersonType
{
public:
	void print() const;

	void setBirthDate (const dateType);
	void getBirthDate (dateType&) const;

	void setAddress (const addressType address);
    void getAddress (addressType& address) const;

	void setPerson (const string, const string);
	void getPerson ( string&, string&) const;

	void setAssociation (const string);
	string getAssociation() const;

	void setPhone (const string);
	string getPhone() const;

	void setExtPerson (string, string, int, int, int, string,
		               string, string, int, string, string)

    extPersonType (string = "", string = "", int = 1, int = 1, int = 1900,
	              string = "", string = "", string = "", int = 0,
				  string = "", string = "");
private:
	personType person;
	dateType birthDate;
	addressType myAddress;
	string association;
	string phone;
};
#endif

Edited by Narue: Added code tags

0

Narue - the entire program exists of 5 header files and 6 cpp files.......way too large unless I could zip it all up and send on here.....not sure

0

Narue - the entire program exists of 5 header files and 6 cpp files.......way too large unless I could zip it all up and send on here.....not sure

My post had two sentences and you clearly only read the first one. :icon_rolleyes:

0
personType(string = "", string ="");
//Constructor with parameters.
//Sets firstName and lastName according to the parameters.
//Postcondition: firstName = first; lastName = last;

That sort of thing is a nonsense. You've got the wrong end of the stick on how to write constructors. I think what that is meant to be is something like:

personType::personType(string first, string last){
  firstname = first;
  lastName = last;
}

or if it's meant to be a default constructor

personType::personType(){
  firstname = " ";
  lastName = " ";
}

You've got your code in the wrong place, and for something that's meant to be a function it's got horribly mangled parameters.

Read this:

http://cplusplus.com/doc/tutorial/functions/

and this:

http://cplusplus.com/doc/tutorial/classes/

and you'll be able to fix it all.

Edited by Moschops: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.