473,404 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

what is the error in this multiple inheritance cpp program?

#include<iostream.h>
#include<conio.h>
class doctor
{
char name[20],dp[20],speci[20];
public:
void read();
void print();
};
class patient
{
char name[20],disease[20];
int age;
public:
void read();
void print();
};
class ip:public doctor,public patient
{
int admino,bedno;
public:
void read();
void print();
};

void doctor::read()
{
cout<<"Name of dr:\n";
cin>>name;
cout<<"Department:\n";

cin>>dp;
cout<<"Specialist:\n";
cin>>speci;
}
void doctor::print()
{

cout<<"Dr name:\t"<<name;
cout<<"\ndepartment name:\t"<<dp;
cout<<"\nspecialist in:\t"<<speci;
}
void patient::read()
{
cout<<"Patient name:\n";
cin>>name;
cout<<"age:\n";
cin>>age;
cout<<"Disease:\n";
cin>>disease;
}
void patient::print()
{
cout<<"\nPatient Name:\t"<<name;
cout<<"\nage:\t"<<age;
cout<<"\ndisease:\t"<<disease;
void ip::read()
{
cout<<" IP PATIENT\n";
cout<<" \/\/\/\/\/\n";
doctor::read();
patient::read();
cout<<"\nEnter the admission date:";
cin>>admino;
cout<<"\nEnter the bed no:";
cin>>bedno;
}
void ip::print()
{
cout<<"\n||||||||||||||||||||||\n";
cout<<"\nDetails of IP Patient\n";
doctor::print();
patient::print();
cout<<"\nadmin no:\n"<<admino;
cout<<"\nbed no:\n"<<bedno;
}
void main()
{
clrscr();
ip obj1;
obj1.read();
obj1.print();
getch();
};
Jul 15 '15 #1
1 1518
weaknessforcats
9,208 Expert Mod 8TB
patient::print() is missing a closing brace.

This literal cout << " \/\/\/\/\/\n"; has the escape sequence character \ so the compiler thinks / is an escape character, which it is not. Use \\ rather than \ to force the \ as a character. Then the / will be OK:

Expand|Select|Wrap|Line Numbers
  1. cout << "   \\/\\/\\/\\/\\/\n";
Jul 15 '15 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Graham Banks | last post by:
Does using multiple inheritance introduce any more performance overhead than single inheritance?
5
by: Mark | last post by:
When declaring a class that uses multiple inheritance, does the order used when listing the inheritance matter? I'm finding with my compiler (gcc 3.2.2) that my program seg faults when destructing...
3
by: Tony Johansson | last post by:
Hello experts! I have a small program that is using multiple inheritance. There are 4 classes involved I get 4 compile error that I can't figure out why. It's this row which is located in the...
2
by: Tony Johansson | last post by:
Hello Experts! I have been playing around a bit with this multiple inheritance and I wonder why do I get a compile error if I remove the virtual keyvord from the declaration of the Student class...
5
by: Tony Johansson | last post by:
Hello Experts! I just play around just to try to understand this about multiple inheritance. You have all the class definition below and at the bottom you have the main program. So here I...
0
by: blackdevil1979 | last post by:
Hello, > "In COM, multiple inheritance between interfaces is not supported. However, by using the derived members capability, multiple inheritance can be simulated."..MSDN Library I have...
5
by: Thomas Girod | last post by:
Hi. I think I'm missing something about multiple inheritance in python. I've got this code. class Foo: def __init__(self): self.x = "defined by foo" self.foo = None
7
by: Adam Nielsen | last post by:
Hi everyone, I'm having some trouble getting the correct chain of constructors to be called when creating an object at the bottom of a hierarchy. Have a look at the code below - the inheritance...
5
by: Hypnotik | last post by:
Hello everyone. I'm working on multiple inheritance program. I have a pretty specific problem that I'm not sure how to overcome. I'm going to try to explain this as simple as possible. There is a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.