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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:22:43+00:00 2026-05-27T03:22:43+00:00

I have below a header file for a stack structure. what I don’t understand

  • 0

I have below a header file for a stack structure. what I don’t understand is this error it is jamming at me:

ISO C++ forbids declaration of ‘Stack’ with no type

Here’s the code :

#include <stdexcept>

class Element;
class Stack{
    public:
        Stack():first(0){}; //constructor
        ~Stack(); //destructor
        void push(int d);
        int pop()throw(length_error);
        bool empty();

    private:
        Element *first;
        Stack(const& Stack){}; //copy constructor
        Stack& operator = (const& Stack){}; //assignment operator..
};

does anyone have a clue what the error means?

  • 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-27T03:22:43+00:00Added an answer on May 27, 2026 at 3:22 am

    Stack& operator = (const& Stack) should be Stack& operator = (const Stack&).

    You can’t have a pointer to a reference or an array of references or anything so the compiler thinks that & must end the type part of the declaration and that the following Stack must be the parameter name. However there’s no type in const& so the compiler says that you can’t declare the parameter Stack with no type. In old versions of C the type int was sometimes inferred in contexts where a type could appear but was omitted which is why the error talks about ISO C++ forbidding this.

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

Sidebar

Related Questions

I have the below structure in my SWIG interface file and thusly my sample.h
I have declared a header file which is giving Syntax error before '{' token.
i have coded a header file which contains a input textbox for search.this header
I have the following structure and object of structure defined in the header file
I have a class with the following property and method: header file below -
I have below query I am trying to show message 'No SubSource for this
My input file is as below : HEADER {ABC|*|DEF {GHI 0 1 0} {{Points
I have some code to do this (which is below) but I get one
I have run this program below with a symbol_list of a few hundreds symbol
I have the following C Header/Code Example: Header file struct category_info { int id;

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.