1 Write a C++ code for a class called Cars with member elements
Wheels
Engine
Steering
Stereo
And a member functions called gear( ), accelerator( ) and brakes( ), runs( )
3 In the class Cars (defined in question-2) initialize member elements Engine and Stereo with product-id using Constructors class and Destructor class. Explain when constructor and destructors are invoked respectively.
4 You have class Cars with you right? Can you inherit two classes called Hyundai and Maruthi-Suzuki with member elements specific to them and write codes showing those two classes.
5 For Cars Class, we have Maruthi-Suzuki and Hyundai as derived class. If Maruthi-Suzuki engine runs on Diesel and Hyundai on Petrol, implement runs( ) member functions and tell how it exhibits polymorphism?
for example1
#include<iostream.h>
#include<conio.h>
class cars
{
int wheels,steering,stero;
char engin[10];
public:void gear();
void accelarator();
void breaks();
void runs();
};
for 3
include<iostream.h>
#include<conio.h>
class cars
{
int wheels,steering,stero;
char engin[10];
public:void gear();
void accelarator();
void breaks();
void runs();
};
class hyundai:public cars
{
char color[10];
int price;
void getdata();
};
class marutisuzuki:public cars
{
int engin_cc,max_speed;
void display();
}
PLZ SEND CODING FAST BECAUSE AFTER 2 DAY MY PRACTICAL EXAME START
This post has been edited by sanjivani182: 06 December 2008 - 11:50 PM

New Topic/Question
Reply




MultiQuote




|