SlideShare a Scribd company logo
ABHISHEK PRATAP 
ROLL NO. : 13-101
#include<iostream.h> 
#include<conio.h> 
#include<string.h> 
class Titan_showroom 
{ 
protected: 
char add[40],color[20],type[20]; 
public: 
Titan_showroom() 
{ strcpy(add,"Panjim"); 
strcpy(color,"White"); 
strcpy(type,"Analog"); 
} 
Titan_showroom(char ad[],char co[],char ty[]) 
{ strcpy(add,ad); 
strcpy(color,co); 
strcpy(type,ty); 
}
void getdata1() 
{ cout<<"n::Enetr the details of Watch::n"; 
cout<<"nEnter the address of Showroom: "; 
cin.getline(add,40); 
cout<<"nEnetr the colour of Watch: "; 
cin.getline(color,20); 
cout<<"nEnetr the type of Watch: "; 
cin.getline(type,20); 
} 
void display1() 
{ cout<<"n::Details of Watch::"; 
cout<<"nAddress of showroom: "<<add; 
cout<<"nWatch colour: "<<color; 
cout<<"nWatch type: "<<type; 
} 
};
class customer:public Titan_showroom 
{ 
protected: 
char name[30],date[20],phone[13]; 
public: 
customer():Titan_showroom() 
{ strcpy(name,"Abhay Singh"); 
strcpy(date,"23-09-2014"); 
strcpy(phone,"9427711999"); 
} 
customer(char ad[],char co[],char ty[],char na[],char da[],char 
ph[]):Titan_showroom(ad,co,ty) 
{ strcpy(name,na); 
strcpy(date,da); 
strcpy(phone,ph); 
}
void getdata2() 
{ clrscr(); 
cout<<"n::::::::::::::::::::::::::||||Abhishek 
Pratap||||:::::::::::::::::::::::::::nn"; 
cout<<"n**Enter Details**n"; 
cout<<"n::Enetr the details of Customer::n"; 
cout<<"nEnter the name of Customer: "; 
cin.getline(name,30); 
cout<<"nEnetr the date of purchase: "; 
cin.getline(date,20); 
cout<<"nEnetr the phone no. of Customer: "; 
cin.getline(phone,13); 
} 
void display2() 
{ cout<<"nn::Details of Customer::"; 
cout<<"nName of Customer: "<<name; 
cout<<"nDate of purchase: "<<date; 
cout<<"nPhone no. of Customer: "<<phone; 
} 
};
class discount 
{ 
protected: 
float price,dis,disp,prip; 
public: 
discount() 
{ price=890; 
dis=0; 
disp=price*dis/100; 
prip=price-disp; 
} 
discount(float pr,float di) 
{ price=pr; 
dis=di; 
disp=price*dis/100; 
prip=price-disp; 
}
void getdata3() 
{ clrscr(); 
cout<<"n::::::::::::::::::::::::::||||Abhishek 
Pratap||||:::::::::::::::::::::::::::nn"; 
cout<<"n**Enter Details**n"; 
cout<<"n::Enetr the details of Discount::n"; 
cout<<"nDISCOUNT ON WATCH COST'S MORE 
THAN OR EQUAL TO RS.1000n"; 
cout<<"nEnter the price of Watch: "; 
cin>>price; 
disc(); 
} 
void disc() 
{ if(price>=1000) 
{ cout<<"nEnter the discount percentage: "; 
cin>>dis; 
disp=price*dis/100; 
} 
prip=price-disp; 
} 
};
class bill:public customer,discount 
{ 
protected: 
long int bill_no; 
public: 
bill():customer(),discount() 
{ bill_no=10294; 
} 
bill(char ad[],char co[],char ty[],char na[],char da[],char ph[],float 
pr,float di,long int bn):customer(ad,co,ty,na,da,ph),discount(pr,di) 
{ bill_no=bn; 
} 
void getdata4() 
{ Titan_showroom::getdata1(); 
customer::getdata2(); 
discount::getdata3(); 
clrscr(); 
cout<<"n::::::::::::::::::::::::::||||Abhishek 
Pratap||||:::::::::::::::::::::::::::nn"; 
cout<<"n**Enter Details**n";
cout<<"n::Eneter the details of Bill::n"; 
cout<<"nEnetr the Bill no.: "; 
cin>>bill_no; 
} 
void display4() 
{ Titan_showroom::display1(); 
customer::display2(); 
cout<<"nn::Bill::"; 
cout<<"nBill no.: "<<bill_no; 
cout<<"nCost of Watch: "<<price; 
cout<<"nDisccount percentage: "<<dis; 
cout<<"nDiscount amount: "<<disp; 
cout<<"nAmount payable: "<<prip; 
} 
};
void main() 
{ clrscr(); 
bill b1,b2; 
cout<<"n::::::::::::::::::::::::::||||Abhishek Pratap||||:::::::::::::::::::::::::::nn"; 
cout<<"n**Enter Details**n"; 
b1.getdata4(); 
clrscr(); 
cout<<"n::::::::::::::::::::::::::||||Abhishek Pratap||||:::::::::::::::::::::::::::nn"; 
cout<<"n**Details**n"; 
b1.display4(); 
getch(); 
clrscr(); 
cout<<"n::::::::::::::::::::::::::||||Abhishek Pratap||||:::::::::::::::::::::::::::nn"; 
cout<<"n**Default construtor**n"; 
cout<<"n**Details**n"; 
b2.display4(); 
getch(); 
clrscr(); 
cout<<"n::::::::::::::::::::::::::||||Abhishek Pratap||||:::::::::::::::::::::::::::nn"; 
cout<<"n**Parameterised construtor**n"; 
cout<<"n**Details**n"; 
bill b3("Margaon","Red","Digital","Ajay Kumar","10-06-2014","8806457389",1500,40,123045); 
b3.display4(); 
getch(); 
clrscr(); 
}
OUT PUT
Hybrid Inheritance in C++
Hybrid Inheritance in C++
Hybrid Inheritance in C++
Hybrid Inheritance in C++
Hybrid Inheritance in C++
Hybrid Inheritance in C++
Hybrid Inheritance in C++

More Related Content

PPT
Module 2 topic 2 notes
DOCX
Cpp programs
PDF
Ooprc3c
TXT
Simulador carrera de caballos desarrollado en C++
DOCX
bank management system
PDF
C++ Programming - 14th Study
DOCX
Document
DOCX
Module 2 topic 2 notes
Cpp programs
Ooprc3c
Simulador carrera de caballos desarrollado en C++
bank management system
C++ Programming - 14th Study
Document

What's hot (17)

PPT
Strongly Connected Components
DOCX
Assignement c++
DOCX
PROGRAM FOR INSERTION SORTING IN ARRAY
DOCX
basic programs in C++
PDF
Alg March 26, 2009
PDF
Insertion sort
PDF
C++ Programming - 3rd Study
DOC
Seg code
PPTX
Lecture 1 string functions
DOCX
Bti1022 lab sheet 8
PDF
Advanced JavaScript Techniques
DOC
oop Lecture 4
DOCX
Computer Science Practical Science C++ with SQL commands
DOCX
Programacion
TXT
Dvst
DOCX
Experement no 6
Strongly Connected Components
Assignement c++
PROGRAM FOR INSERTION SORTING IN ARRAY
basic programs in C++
Alg March 26, 2009
Insertion sort
C++ Programming - 3rd Study
Seg code
Lecture 1 string functions
Bti1022 lab sheet 8
Advanced JavaScript Techniques
oop Lecture 4
Computer Science Practical Science C++ with SQL commands
Programacion
Dvst
Experement no 6
Ad

Viewers also liked (20)

PPSX
PPTX
Inheritance in c++
PPTX
inheritance c++
PPSX
PPTX
Inheritance
PPT
11 constructors in derived classes
PPT
Multi level hierarchy
PDF
C++ Multiple Inheritance
PPTX
Hierarchical inheritance
PDF
Multiple Inheritance
PPT
Container ship
PPT
Inheritance
PPTX
[OOP - Lec 19] Static Member Functions
PPT
Templates
PDF
Multiple Inheritance For C++
PPT
Inheritance, Object Oriented Programming
PPTX
Types of Inheritance
PPT
PPT
Inheritance, polymorphisam, abstract classes and composition)
Inheritance in c++
inheritance c++
Inheritance
11 constructors in derived classes
Multi level hierarchy
C++ Multiple Inheritance
Hierarchical inheritance
Multiple Inheritance
Container ship
Inheritance
[OOP - Lec 19] Static Member Functions
Templates
Multiple Inheritance For C++
Inheritance, Object Oriented Programming
Types of Inheritance
Inheritance, polymorphisam, abstract classes and composition)
Ad

Similar to Hybrid Inheritance in C++ (20)

DOC
Shopping mall
PDF
Kirti Kumawat, BCA Third Year
PDF
Reshma Kodwani , BCA Third Year
PDF
#include stdafx.h#include iostream#include Stringusing.pdf
PDF
oodp elab.pdf
PDF
#include stdafx.h#include iostreamusing namespace std;cl.pdf
DOCX
Billing in a supermarket c++
DOCX
computer project on shopping mall..cbse 2017-2018 project
DOCX
CS Project-Source code for shopping inventory for CBSE 12th
DOCX
#include iostream#include stringusing namespace std;.docx
PDF
I finished most of the program, but having trouble with some key fea.pdf
PPT
Presentation
PDF
show code and all classes with full implementation for these Program S.pdf
PDF
So I already have most of the code and now I have to1. create an .pdf
PPT
PDF
#includeiostream #includecmath #includestringusing na.pdf
PDF
Computer Science Sample Paper 2015
DOCX
Program Specifications Develop an inventory management system for an e.docx
DOC
C Programming :- An Example
DOCX
Oop lab report
Shopping mall
Kirti Kumawat, BCA Third Year
Reshma Kodwani , BCA Third Year
#include stdafx.h#include iostream#include Stringusing.pdf
oodp elab.pdf
#include stdafx.h#include iostreamusing namespace std;cl.pdf
Billing in a supermarket c++
computer project on shopping mall..cbse 2017-2018 project
CS Project-Source code for shopping inventory for CBSE 12th
#include iostream#include stringusing namespace std;.docx
I finished most of the program, but having trouble with some key fea.pdf
Presentation
show code and all classes with full implementation for these Program S.pdf
So I already have most of the code and now I have to1. create an .pdf
#includeiostream #includecmath #includestringusing na.pdf
Computer Science Sample Paper 2015
Program Specifications Develop an inventory management system for an e.docx
C Programming :- An Example
Oop lab report

Recently uploaded (20)

PPTX
master seminar digital applications in india
PPTX
Cell Structure & Organelles in detailed.
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
01-Introduction-to-Information-Management.pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Complications of Minimal Access Surgery at WLH
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
master seminar digital applications in india
Cell Structure & Organelles in detailed.
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
TR - Agricultural Crops Production NC III.pdf
01-Introduction-to-Information-Management.pdf
VCE English Exam - Section C Student Revision Booklet
Complications of Minimal Access Surgery at WLH
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
O5-L3 Freight Transport Ops (International) V1.pdf
STATICS OF THE RIGID BODIES Hibbelers.pdf
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
Renaissance Architecture: A Journey from Faith to Humanism
FourierSeries-QuestionsWithAnswers(Part-A).pdf
Week 4 Term 3 Study Techniques revisited.pptx
Abdominal Access Techniques with Prof. Dr. R K Mishra

Hybrid Inheritance in C++

  • 1. ABHISHEK PRATAP ROLL NO. : 13-101
  • 2. #include<iostream.h> #include<conio.h> #include<string.h> class Titan_showroom { protected: char add[40],color[20],type[20]; public: Titan_showroom() { strcpy(add,"Panjim"); strcpy(color,"White"); strcpy(type,"Analog"); } Titan_showroom(char ad[],char co[],char ty[]) { strcpy(add,ad); strcpy(color,co); strcpy(type,ty); }
  • 3. void getdata1() { cout<<"n::Enetr the details of Watch::n"; cout<<"nEnter the address of Showroom: "; cin.getline(add,40); cout<<"nEnetr the colour of Watch: "; cin.getline(color,20); cout<<"nEnetr the type of Watch: "; cin.getline(type,20); } void display1() { cout<<"n::Details of Watch::"; cout<<"nAddress of showroom: "<<add; cout<<"nWatch colour: "<<color; cout<<"nWatch type: "<<type; } };
  • 4. class customer:public Titan_showroom { protected: char name[30],date[20],phone[13]; public: customer():Titan_showroom() { strcpy(name,"Abhay Singh"); strcpy(date,"23-09-2014"); strcpy(phone,"9427711999"); } customer(char ad[],char co[],char ty[],char na[],char da[],char ph[]):Titan_showroom(ad,co,ty) { strcpy(name,na); strcpy(date,da); strcpy(phone,ph); }
  • 5. void getdata2() { clrscr(); cout<<"n::::::::::::::::::::::::::||||Abhishek Pratap||||:::::::::::::::::::::::::::nn"; cout<<"n**Enter Details**n"; cout<<"n::Enetr the details of Customer::n"; cout<<"nEnter the name of Customer: "; cin.getline(name,30); cout<<"nEnetr the date of purchase: "; cin.getline(date,20); cout<<"nEnetr the phone no. of Customer: "; cin.getline(phone,13); } void display2() { cout<<"nn::Details of Customer::"; cout<<"nName of Customer: "<<name; cout<<"nDate of purchase: "<<date; cout<<"nPhone no. of Customer: "<<phone; } };
  • 6. class discount { protected: float price,dis,disp,prip; public: discount() { price=890; dis=0; disp=price*dis/100; prip=price-disp; } discount(float pr,float di) { price=pr; dis=di; disp=price*dis/100; prip=price-disp; }
  • 7. void getdata3() { clrscr(); cout<<"n::::::::::::::::::::::::::||||Abhishek Pratap||||:::::::::::::::::::::::::::nn"; cout<<"n**Enter Details**n"; cout<<"n::Enetr the details of Discount::n"; cout<<"nDISCOUNT ON WATCH COST'S MORE THAN OR EQUAL TO RS.1000n"; cout<<"nEnter the price of Watch: "; cin>>price; disc(); } void disc() { if(price>=1000) { cout<<"nEnter the discount percentage: "; cin>>dis; disp=price*dis/100; } prip=price-disp; } };
  • 8. class bill:public customer,discount { protected: long int bill_no; public: bill():customer(),discount() { bill_no=10294; } bill(char ad[],char co[],char ty[],char na[],char da[],char ph[],float pr,float di,long int bn):customer(ad,co,ty,na,da,ph),discount(pr,di) { bill_no=bn; } void getdata4() { Titan_showroom::getdata1(); customer::getdata2(); discount::getdata3(); clrscr(); cout<<"n::::::::::::::::::::::::::||||Abhishek Pratap||||:::::::::::::::::::::::::::nn"; cout<<"n**Enter Details**n";
  • 9. cout<<"n::Eneter the details of Bill::n"; cout<<"nEnetr the Bill no.: "; cin>>bill_no; } void display4() { Titan_showroom::display1(); customer::display2(); cout<<"nn::Bill::"; cout<<"nBill no.: "<<bill_no; cout<<"nCost of Watch: "<<price; cout<<"nDisccount percentage: "<<dis; cout<<"nDiscount amount: "<<disp; cout<<"nAmount payable: "<<prip; } };
  • 10. void main() { clrscr(); bill b1,b2; cout<<"n::::::::::::::::::::::::::||||Abhishek Pratap||||:::::::::::::::::::::::::::nn"; cout<<"n**Enter Details**n"; b1.getdata4(); clrscr(); cout<<"n::::::::::::::::::::::::::||||Abhishek Pratap||||:::::::::::::::::::::::::::nn"; cout<<"n**Details**n"; b1.display4(); getch(); clrscr(); cout<<"n::::::::::::::::::::::::::||||Abhishek Pratap||||:::::::::::::::::::::::::::nn"; cout<<"n**Default construtor**n"; cout<<"n**Details**n"; b2.display4(); getch(); clrscr(); cout<<"n::::::::::::::::::::::::::||||Abhishek Pratap||||:::::::::::::::::::::::::::nn"; cout<<"n**Parameterised construtor**n"; cout<<"n**Details**n"; bill b3("Margaon","Red","Digital","Ajay Kumar","10-06-2014","8806457389",1500,40,123045); b3.display4(); getch(); clrscr(); }