Unfamiliar Compilation Errors In a Linked List Class (C++)

  • #1
rtareen
162
32
Homework Statement:
This program will have names and addresses saved in a linked list. In addition, a birthday and anniversary date will be saved with each record. The linked list should be implemented as its own class.
Relevant Equations:
none
Hi all. I'm working on my final project for a class. The assignment is to have a linked list of personal records, and then do some things with it. Right now I'm working on the linked list class "List.h". I've implemented a Person class "Person.h" as a composition of 3 subclasses "Address.h", "Date.h" and "Name.h". I've attached all of these as text files (I'm not allowed to attach .h files?). I'm able to compile "Address.h", "Date.h", "Name.h" and "Person.h" without any issues. But when I'm trying to compile "List.h" I get some serious compilation errors (attached). The most serious is the one that says my Node struct is implicitly deleted. I need some help on how to solve this without re-doing everything I've already done. Please help.
errors.jpg
 

Attachments

  • Date.txt
    1.3 KB · Views: 39
  • Name.txt
    598 bytes · Views: 39
  • Person.txt
    952 bytes · Views: 38
  • List.txt
    1.1 KB · Views: 42

Answers and Replies

  • #2
rtareen
162
32
My Address.txt file is not showing up so I'm pasting it here
Edit by moderator: Added code tags
C++:
include <iostream>
#include <string>
using std::cout;
using std::string;

class Address
{
    public:
        Address(int num = 0, string name = "Default Rd", int unit = 0, string town = "Deafult City", string _state = "AK", string zipCode = "00000")
        {
            setStreetNumber(num);
            setStreetName(name);
            setUnitNumber(unit);
            setCity(town);
            setState(_state);
            setZip(zipCode);
        }
        void setStreetNumber(int num)
        {
            if (num < 0)
            {
                cout << "Invalid street number. Setting to default value: 0.\n";
                streetNumber = 0;
            }
            else
                streetNumber = num;
        } 
        void setStreetName(string name)
        {
            streetName = name;
        }
        void setUnitNumber(int unit)
        {
            if (unit < 0)
            {
                cout << "Invalid unit number. Setting to default value: 0.\n";
                unitNumber = 0;
            }
            else
                unitNumber = unit;
        }
        void setCity(string town)
        {
            if(town.length() > 20)
            {
                town = town.substr(0,20);
                cout << "City name too large. Limiting to 20 characters.\n";
            }
            city = town;
        }
        void setState(string _state)
        {
            if(_state.length() != 2)
            {
                cout << "State must be 2 characters. Setting to default value: AK.\n";
                state = "AK";
            }
            else
            {
                for(int i = 0; i < 2; i++)
                    _state[ i] = toupper(_state[ i]);
                state = _state;
            }
        }
        void setZip(string zipCode)
        {
            if (zipCode.length() > 5)
            {
                cout << "Zip code too long. Limiting to 5 characters.\n";
                zipCode = zipCode.substr(0,5);
                zip = zipCode;
            }
            else if( zipCode.length() < 5)
            {
                cout << "Zip code too short. Setting to deafault value: 00000.\n";
                zip = "00000";
            }
            else
                zip = zipCode;
        }
        int getStreetNumber()
        {
            return streetNumber;
        }
        string getStreetName()
        {
            return streetName;
        }
        int getUnitNumber()
        {
            return unitNumber;
        }
        string getCity()
        {
            return city;
        }
      
        string getState()
        {
            return state;
        }
        string getZip()
        {
            return zip;
        }
  
    private:
        int streetNumber;
        string streetName;
        int unitNumber;
        string city;
        string state;
        string zip;
};
 
Last edited by a moderator:
  • #3
36,880
8,928
But when I'm trying to compile "List.h" I get some serious compilation errors (attached). The most serious is the one that says my Node struct is implicitly deleted.
Your attachment, errors.jpg, is impossible for me to read. I can barely read the lines with white text, but the lines that describe errors are red against a black background, which makes them impossible for me to read. Please copy the contents of the compiler output as text and post it directly, not as an image.
 

Suggested for: Unfamiliar Compilation Errors In a Linked List Class (C++)

Replies
12
Views
2K
  • Last Post
Replies
12
Views
584
Replies
17
Views
725
  • Last Post
Replies
2
Views
776
Comp Sci Class and vector
  • Last Post
Replies
2
Views
607
  • Last Post
Replies
15
Views
653
  • Last Post
Replies
4
Views
587
  • Last Post
Replies
4
Views
810
  • Last Post
Replies
7
Views
2K
Top