I am getting the following error codes when trying to compile the following 2 files

1>c:\users\adam-7\documents\visual studio 2010\projects\chapter 13\exc_1\exc_1\cd.cpp(9): error C2533: 'Cd::{ctor}' : constructors not allowed a return type
1>c:\users\adam-7\documents\visual studio 2010\projects\chapter 13\exc_1\exc_1\cd.cpp(58): error C2264: 'Cd::Cd' : error in function definition or declaration; function not called

Provided the code, any ideas? I don't get it :S Ty for help :)

// base class

class Cd { // represents a CD disk
	private:
		char performers[50];
		char label[20];
		int selections; // number of selections
		double playtime; // playing time in minutes
	public:
		Cd(char * s1, char * s2, int n, double x);
		Cd(const Cd & d);
		Cd();
		~Cd() {};
		virtual void Report() const; // reports all CD data
		virtual Cd & operator=(const Cd & d);
};

class Classic : public Cd
{
	private:
		char work[50];
	public: 
		Classic(char * s3, char * s1, char * s2, int n, double x);
		Classic();
		Classic(const char *s1, const Cd & cl);
		~Classic() {};
		virtual void Report() const;
		virtual Classic & operator=(const Classic & d);
}
// Cd.cpp containing class declarations

#include "stdafx.h"
#include <iostream>
#include <cstring>
#include "CD.h"

Cd::Cd(char * s1, char * s2, int n, double x)
{
	strncpy(performers, s1, 49);
	performers[49] = '\0';
	strncpy(label, s2, 19);
	performers[19] = '\0';
	selections = n;
	playtime = x;
}

Cd::Cd(const Cd & d)
{
	strcpy_s(performers, d.performers);
	strcpy_s(label, d.label);
	selections = d.selections;
	playtime = d.playtime;
}

Cd::Cd()
{
	strncpy(performers, "None", 4);
	performers[4] = '\0';
	strncpy(label, "None", 4);
	label[4] = '\0';
	selections = 0;
	playtime = 0.0;
}

void Cd::Report() const // reports all CD data
{
	std::cout << "Performers are " << performers << std::endl;
	std::cout << "Label is " << label << std::endl;
	std::cout << "Number of selections are " << selections << std::endl;
	std::cout << "Playtime is " << playtime << std::endl;
}

Cd & Cd::operator=(const Cd & d)
{
	if (this == &d)
		return *this;
	strncpy(performers, d.performers, 49);
	performers[49] = '\0';
	strncpy(label, d.label, 19);
	performers[19] = '\0';
	selections = d.selections;
	playtime = d.playtime;
	return *this;
}

Classic::Classic(char * s3, char * s1, char * s2, int n, double x) : Cd(s1, s2, n, x)
{
	strncpy(work, s3, 49);
	work[49] = '\0';
}

Classic::Classic() : Cd()
{
	strncpy(work, "None", 4);
	work[4] = '\0';
}

Classic::Classic(const char *s1, const Cd & cl) : Cd(cl)
{
	strncpy(work, s1, 50);
	work[50] = '\0';
}

void Classic::Report() const
{
	Cd::Report();
	std::cout << "Work is " << work << std::endl;
}

Classic & Classic::operator=(const Classic & d)
{
	if (this == &d)
		return *this;
	Cd::operator=(d);
	strncpy(work, d.work, 50);
	work[50] = '\0';
	return *this;
}

You're missing a terminating semicolon on the Classic class.

Haha i always forget that damn semicolon! Ty :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.