Can anyone please look at code and tel what is issue in
Laptop::Laptop(int wdSize, int memSize,int storSize, int spee,int wid, int hei , int len , int wait )
{
Computer::Computer(int wdSize, int memSize, int storSize , int spee);
width=wid;
length=len;
height=hei;
weight=wait;
}
Computer::show(); which is a base class member is not being called here.Compute::show() is define in below code. M using cfree boorland 5 compiler.
orignal code is below
#include<iostream.h>
#include<conio.h>
class Computer
{
protected:
int wordSize;
int memorySize;
int storageSize;
int speed;
public:
Computer(){}
Computer(int,int,int,int);
void show();
};
class Laptop
{
private:
int width;
int height;
int length;
int weight;
public:
Laptop(){}
Laptop(int,int,int,int,int,int,int,int);
void show();
};
Computer::Computer(int wdSize, int memSize, int storSize ,int spee)
{
wordSize=wdSize;
memorySize=memSize;
storageSize=storSize;
speed=spee;
}
void Computer::show()
{
cout<<"Word Size :"<<wordSize<<endl;
cout<<"Memory Size: "<<memorySize<<endl;
cout<<"Storage Size"<<storageSize<<endl;
cout<<"Speed :"<<speed;
}
Laptop::Laptop(int wdSize, int memSize,int storSize, int spee,int wid, int hei , int len , int wait )
{
Computer::Computer(int wdSize, int memSize, int storSize , int spee);
width=wid;
length=len;
height=hei;
weight=wait;
}
void Laptop::show()
{ Computer::show();
cout<<"weight is="<<weight<<endl;
cout<<"height is ="<<height<<endl;
cout<<"length is ="<<length<<endl;
cout<<"width is ="<<width<<endl;
}
void main()
{
clrscr();
Computer comp(4,512,20,2);
Laptop lap(8,1024,50,2,15,19,14,2);
cout<<"Computer Specifications are"<<endl;
comp.show();
cout<<":Laptop specifications are"<<endl;
lap.show();
getch();
}