/////////interface
//appication.h
#ifndef APPLICATION_MAIN_H
#define APPLICATION_MAIN_H

#include<string>
using std::string;

class appliance
{
protected:
	string Manufacturer;
	string Type;
public:
	appliance(string a,string b);
	~appliance();
	void setManufacturer(string a);
	string getManufacturer();
	void setType(string b);
	string getType();
	void showDetails();
};

#endif
///////implementation////////////////////
//appication.cpp
#include<iostream>
using std::cout;
using std::cin;
using std::endl;

#include<string>
using std::string;

#include "appication.h"

appliance::appliance(string a,string b)
{
	Manufacturer=a;
	Type=b;
}
appliance::~appliance()
{
	cout<<"destructor"<<endl;	
}

void appliance::setManufacturer(string a)
{
	Manufacturer=a;
}
string appliance::getManufacturer()
{
	return Manufacturer;//destructor
}

void appliance::setType(string b)
{
	Type=b;
}

string appliance::getType()
{
	return Type;
}

void appliance::showDetails()
{
	cout<<Manufacturer<<endl;
	cout<<Type<<endl;
}
///////////derive class//////////
//application.h
#ifndef APPLICATION_MAIN_H
#define APPLICATION_MAIN_H

#include<string>
using std::string;

#include<iostream>
using std::cin;
using std::endl;
using std::cout;

#include "appication.h"

class television:public application
{
protected:
	  int ScreenSize;
	  int LoadSizeRation;
  public:
	  television(string a,string b, int c, int d);
	  ~television();
	  void setScreenSize(int c);
	  int getScreenSize();
	  void setLoadSize(int d);
	  int getLoadSize();
	  void showDetails() const;
};

#endif
//////derive class implementation
//application_tel.cpp
#include<iostream>
using std::endl;
using std::cout;
using std::cin;

#include<string>
using std::string;

#include "application_tel.h"

television::television(string a,string b,int c, int d)

: appliance(a,b)
{
		ScreenSize(c);//(a>=1.0) ? 1.0:(c);//baseSalary = ( salary < 0.0 ) ? 0.0 : salary;
		LoadSizeRation(d);
}
television::~television()
{
	cout<<"destructor"<<endl;
}

void television::setScreenSize(int c)
{
	ScreenSize=c;
}

int television::getScreenSize()
{
	return ScreenSize;
}

void television::setLoadSize(int d)
{
	LoadSizeRation=d;
}

int television::getLoadSize()
{
	return LoadSizeRation;
}


void television::showDetails()
{
	cout<<"the screen size is"<<ScreenSize<<endl;
	cout<<"the load is"<<LoadSizeRation<<endl;
}
///////////////main function///////////////
///application_main
#include<iostream>
using std::cin;
using std::cout;
using std::endl;

#include<string>
using std::string;

#include "application_tel.h"
void main()
{

	television tv1("Song","Tel",15,2);
	}

Recommended Answers

All 4 Replies

What about inheritance do you need help with?

i keep on running the program, but i just cant figure out how to solve the errors in it................i understand the concept and everything but.........i still cant reslove the errors i am finding......the errors are listed below:

--------------------Configuration: Inheritance - Win32 Debug--------------------
Compiling...
application_main.cpp
c:\documents and settings\kemoy\desktop\thurday\c++\application_tel.h(15) : error C2504: 'application' : base class undefined
application_tel.cpp
c:\documents and settings\kemoy\desktop\thurday\c++\application_tel.h(15) : error C2504: 'application' : base class undefined
C:\Documents and Settings\kemoy\Desktop\thurday\c++\application_tel.cpp(14) : error C2614: 'television' : illegal member initialization: 'appliance' is not a base or member
C:\Documents and Settings\kemoy\Desktop\thurday\c++\application_tel.cpp(15) : error C2064: term does not evaluate to a function
C:\Documents and Settings\kemoy\Desktop\thurday\c++\application_tel.cpp(16) : error C2064: term does not evaluate to a function
C:\Documents and Settings\kemoy\Desktop\thurday\c++\application_tel.cpp(45) : error C2511: 'showDetails' : overloaded member function 'void (void)' not found in 'television'
c:\documents and settings\kemoy\desktop\thurday\c++\application_tel.h(14) : see declaration of 'television'
Error executing cl.exe.

Inheritance.exe - 6 error(s), 0 warning(s)

you didn't post application_tel.h, but most likely the reason for those errors is that that file does not include another header (appication.h).

the derive class should be application_tel.h..............but insteadi have 2 files with the name "appication.h".......

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.