1 Replies - 22337 Views - Last Post: 03 June 2008 - 05:44 PM Rate Topic: -----

#1 nirali35  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 24-September 06

is not a class or namespace name error

Posted 03 June 2008 - 06:06 AM

Hello people,

While compiling the code in set of files below, I get the following error:
Error	1	error C2653: 'Member' : is not a class or namespace name	c:\personal\nu\csc 300\project\library\library\book.h	50	

Error	2	error C2653: 'Member' : is not a class or namespace name	c:\personal\nu\csc 300\project\library\library\book.h	51	



Here is the code:

Book.h:
#pragma once
#include "Member.h"

class Book
{
public:
	Book(
		char* _name,
		char* _title,
		char* _description,
		char* _author,
		char* _publisher,
		char* _publishDate,
		int _pages
	);
	~Book(void);
private:
	char* name;
	char* title;
	char* description;
	char* author;
	char* publisher;
	char* publishDate;
	int pages;
	
	char* status;       // in, out, usage
	char* usingGuest;   // Name of guest currently reading the book
	int checkOutMember; // Member ID who checked out this book
	char* checkOutDate;
	char* checkInDate;
public:
	char* getName(void);
	char* getTitle(void);
	char* getDescription(void);
	char* getAuthor(void);
	char* getPublisher(void);
	char* getPublishDate(void);
	int getPages(void);
	char* getStatus(void);
	char* getUsingGuest(void);
	int getCheckOutMember(void);
	char* getCheckOutDate(void);
	char* getCheckInDate(void);

	int read(char* _usingGuest);
private:
	int checkOut(int _checkOutMember, char* _checkOutDate);
	int checkIn(char* _checkInDate);

	friend int Member::checkOut();
	friend int Member::checkIn();
};



Book.cpp:
#include "Book.h"

Book::Book(
	char* _name,
	char* _title,
	char* _description,
	char* _author,
	char* _publisher,
	char* _publishDate,
	int _pages
)
{
	name = _name;
	title = _title;
	description = _description;
	author = _author;
	publisher = _publisher;
	publishDate = _publishDate;
	pages = _pages;
}

Book::~Book(void)
{
}

char* Book::getName(void)
{
	return name;
}

char* Book::getTitle(void)
{
	return title;
}

char* Book::getDescription(void)
{
	return description;
}

char* Book::getAuthor(void)
{
	return author;
}

char* Book::getPublisher(void)
{
	return publisher;
}

char* Book::getPublishDate(void)
{
	return publishDate;
}

int Book::getPages(void)
{
	return pages;
}

char* Book::getStatus(void)
{
	return status;
}

char* Book::getUsingGuest(void)
{
	return usingGuest;
}

int Book::getCheckOutMember(void)
{
	return checkOutMember;
}

char* Book::getCheckOutDate(void)
{
	return checkOutDate;
}

char* Book::getCheckInDate(void)
{
	return checkInDate;
}

int Book::read(char* _usingGuest)
{
	if(_usingGuest != ""){
		usingGuest = _usingGuest;
		status = "usage";

		return 1;
	}
	
	return 0;
}

int Book::checkOut(int _checkOutMember, char* _checkOutDate)
{
	if(_checkOutMember && _checkOutDate != ""){
		checkOutMember = _checkOutMember;
		checkOutDate = _checkOutDate;
		status = "out";

		return 1;
	}

	return 0;
}

int Book::checkIn(char* _checkInDate)
{
	if(_checkInDate != ""){
		_checkInDate = _checkInDate;
		status = "in";

		return 1;
	}

	return 0;
}



Guest.h:
#pragma once
#include "Book.h"

class Guest
{
public:
	Guest(char* _name);
	~Guest(void);
protected:
	char* name;
public:
	int read(Book &_book);
};



Guest.cpp:
#include "Guest.h"

Guest::Guest(char* _name)
{
	name = _name;
}

Guest::~Guest(void)
{
}

int Guest::read(Book &_book)
{
	return _book.read(name);
}



Member.h:
#pragma once
#include "Guest.h"
#include "Book.h"

class Member :
	public Guest
{
public:
	Member(char* _name, int _id);
	~Member(void);
private:
	int id;
public:
	int read(Book &_book);
	int checkOut(void);
	int checkIn(void);
};



Member.cpp:
#include "Member.h"

Member::Member(char* _name, int _id) : Guest(_name)
{
	id = _id;
}

Member::~Member(void)
{
}

int Member::read(Book &_book)
{
	Guest::read(_book);
}

int Member::checkOut(void)
{
	return 0;
}

int Member::checkIn(void)
{
	return 0;
}



Guys, I really need to solve this ASAP. I would really appriciate all of your help :)

Thanks

Is This A Good Question/Topic? 0
  • +

Replies To: is not a class or namespace name error

#2 skater_00  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 12
  • View blog
  • Posts: 256
  • Joined: 30-April 08

Re: is not a class or namespace name error

Posted 03 June 2008 - 05:44 PM

Seems like he got the problem solved on DaniWeb.com: http://www.daniweb.c...post619823.html
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1