Thread: problem w/ header

  1. #1
    Registered User blight2c's Avatar
    Join Date
    Mar 2002
    Posts
    266

    problem w/ header

    hey, i can't get this to go. a little help . . . thanks

    Code:
    #include <iostream.h>
    
    class c_sequence
    {
    	protected:
    		int back;
    		int data[10];
    	public:
    		c_sequence();
    		virtual mf_poke(char ch);
    		virtual mf_pop(void)=0;
    		virtual mf_peek(void)=0;
    };
    
    c_sequence::c_sequence()
    {	
    	back=0;
    }
    
    void c_sequence::mf_poke(char ch)  //error:not a member 
    {
    	if (back<0)
    	{
    		data[back]=ch;
    		back++;
    		cout<<endl;
    	}
    	else
    		cout<<"sorry, stack full"<<endl<<endl;  //error should return a value
    }

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >virtual mf_poke(char ch);
    changed to
    virtual void mf_poke(char ch);
    equals no more errors

    Any method that isn't a constructor or destructor must return a value, even it it's void.

    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling problem: "Invalid header in executable"
    By ckyle in forum C Programming
    Replies: 5
    Last Post: 02-28-2006, 02:00 AM
  2. Linking header files, Source files and main program(Accel. C++)
    By Daniel Primed in forum C++ Programming
    Replies: 3
    Last Post: 01-17-2006, 11:46 AM
  3. Header file creation problem
    By ToxicLove in forum C Programming
    Replies: 2
    Last Post: 05-17-2004, 10:25 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  5. Replies: 5
    Last Post: 12-03-2003, 05:47 PM