Exp.4 Write any C++ programs to demonstrate multiple inheritance concept of an object oriented programming.

Exp.4 Write any C++ programs to demonstrate multiple inheritance concept of an object oriented programming.

(Aim:- The main aim of this experiment is reusability of code and getting idea about classifying objects , identifying specific and generic objects and creating hierarchy between objects ). Objective: Student will get awareness to create relationship between objects.

View Answers

October 31, 2012 at 10:12 AM

Here is a code that demonstrates you the concept of multiple inheritance.

#include<iostream.h>
#include<conio.h>

class student
{
    protected:
       int rno,m1,m2;
    public:
                void get()
              {
                            cout<<"Enter the Roll no :";
                            cin>>rno;
                            cout<<"Enter the two marks   :";
                            cin>>m1>>m2;
              }
};
class sports
{
    protected:
       int sm;                   
    public:
                void getsm()
              {
                 cout<<"\nEnter the sports mark :";
                 cin>>sm;

              }
};
class statement:public student,public sports
{
    int tot,avg;
    public:
    void display()
              {
                 tot=(m1+m2+sm);
                 avg=tot/3;
                 cout<<"\n\n\tRoll No    : "<<rno<<"\n\tTotal      : "<<tot;
               cout<<"\n\tAverage    : "<<avg;
              }
};
void main()
{
   clrscr();
   statement obj;
   obj.get();
   obj.getsm();
   obj.display();
   getch();
}









Related Tutorials/Questions & Answers:
Exp.4 Write any C++ programs to demonstrate multiple inheritance concept of an object oriented programming.
Exp.4 Write any C++ programs to demonstrate multiple inheritance concept of an object oriented programming.  (Aim:- The main aim of this experiment...; Here is a code that demonstrates you the concept of multiple inheritance
Object Oriented Programming in Java
OOPS acronym for Object Oriented Programming is a model or concept that works... is an instance of a class. For a language to be an Object Oriented Programming... concept are used to create programs based on the real world. By the name OOPS
Advertisements
Inheritance in java with example
Inheritance in java with example          Inheritance is one of the concept of the Object- Oriented programming. The advantage of using the inheritance
object oriented programming protocol
object oriented programming protocol  What is object oriented programming protocol? Is it different from objective c protocol programming?? Thanks
Object Oriented Programming in PHP
Object Oriented Programming in PHP  Hi, Which version of PHP supports OOPS. How can I learn Object Oriented Programming in PHP? Thanks (adsbygoogle = window.adsbygoogle || []).push
Object Oriented Programming II
Object Oriented Programming II  Instructions: ->each class to be created must have encapsulated fields, setters and getters methods, and constructors Create a class named "Paper" with the following attributes
An Overview of Java      Java is a programming language      Java is Object Oriented Programming
; Java as a programming language Java is an Object oriented... are in an object-oriented form of C which are being provided by javah , but they are still...; Java as an Object Oriented Language In this section, we will discuss the OOPs
Difference between Java and C++
that supports procedural programming and object oriented programming. C++ fully... and application programming. C++ has added support for object-oriented programming...++. C++ supports procedural, functional and object oriented programming
object oriented programming - Java Beginners
object oriented programming  sir, i read in the book tat object oriented program exhibits recurring structures. i want to know "what is meant by recurring structures?"  Hi Friend, Any structure to be occurred over
What are the features and advantages of OBJECT ORIENTED PROGRAMMING?
What are the features and advantages of OBJECT ORIENTED PROGRAMMING?  What are the features and advantages of OBJECT ORIENTED PROGRAMMING
object oriented programming data science
object oriented programming data science  Hi, I am beginner in Data...: object oriented programming data science Try to provide me good examples or tutorials links so that I can learn the topic "object oriented programming
Object-Oriented programming - Java Beginners
Object-Oriented programming  Write a program to display the names and salaries of 5 employees.Make use of a class and an array.The salary of each employee should increase by 5% and displayed back.  Hi friend, Code
Is Java object oriented?
Is Java object oriented?  Hi, Is Java object oriented? Thanks   Hi, Java is object oriented programming language. It is supports OPPS concepts: Object Class Inheritance Polymorphism Abstraction Encapsulation All
Concept of Inheritance in Java
Concept of Inheritance in Java Concept of Inheritance in Java is considered one of the important features of Object Oriented Programming. Inheritance... it. To know the concept of Inheritance clearly you must have the idea
Object Oriented
Object Oriented  C++ is Purely object oriented or not .Then why java called purely object oriented
Java using Netbeans Object Oriented Programming
Java using Netbeans Object Oriented Programming   I am trying to make a program that uses a main class and a separate class with one public method and one private method. The main method in the main class asks the user for 2
Multiple Inheritance
class so java any how do multiple inheritance? Can you please explain...Multiple Inheritance  All are saying java doesn't support multiple inheritance but by default Object class is super class for all the user defined
multiple inheritance.
multiple inheritance.  hello, can java support multiple inheritance???   hi,ADS_TO_REPLACE_1 java does not support multiple inheritance
Inheritance in Java
Inheritance, one of the important concepts of Object Oriented Programming... and it's parent class.ADS_TO_REPLACE_2 Multilevel Inheritance: Multiple... inheritance can go up to any number of level.ADS_TO_REPLACE_3 * Though Java does
Learning Java Programming for Beginners
Java is an Object Oriented Programming Language that was developed by Sun Microsystems. It is based on C, C++ programming language but a tad better... are eyeing the vast field of programming and software development
java is pure object oriented
are not object 2)It does not support operator overloading multiple inheritance. 3...java is pure object oriented  java is pure object oriented or not.? reason.?   Java is not pure object oriented language because
multiple inheritance
multiple inheritance  why java doesn't support multiple inheritance? we can achieve this by using interface but not with classes? what is the main reason that java community implemented like
Is Java a pure object oriented language?
programming language but not purely a object oriented language. In OOPs programming... through the class and object creation. For more object oriented programming language...Is Java a pure object oriented language?   Hi, Is Java a pure
Inheritance in Java with example
Here we are going to discuss Inheritance in Java with a simple example. Inheritance is a Object Oriented Programming concepts, which allows to extend... into a single class. Multiple inheritance in Java can be achieved by interface
Multiple Inheritance
Multiple Inheritance  Why Java Doesn't have Multiple Inheritance It is Advantage or Disadvantage.........   Hi Friend, When we extends... and inconsistencies Java does not support Multiple Inheritance. Thanks
Java as an Object Oriented Language
applications and programs. OOP stands for Object Oriented Programming.... There are four main pillars of an Object Oriented Programming Language... is the basic entity of object oriented programming language. Class itself does nothing
Does Java support multiple Inheritance?
Does Java support multiple Inheritance?  Hi, I am beginner in Java and trying to implement multiple inheritance in Java. But could not find any example. Does Java support multiple Inheritance? Thanks   Hi, Good
Does Java support multiple Inheritance?
Does Java support multiple Inheritance?  Hi, I am beginner in Java and trying to implement multiple inheritance in Java. But could not find any example. Does Java support multiple Inheritance? Thanks   Hi, Good
Does Java support multiple Inheritance?
Does Java support multiple Inheritance?  Hi, I am beginner in Java and trying to implement multiple inheritance in Java. But could not find any example. Does Java support multiple Inheritance? Thanks   Hi, Good
multiple inheritance
multiple inheritance  Class A extends Class B but Class A also inherit Super Class Object so it is multiple inheritence give reason in support of your answer
Java Inheritance Concept.
Java Inheritance Concept.  Yesterday i got confused with following question in an aptitude exam. Question:Class A,B,C have method named doit(). Class B extends Class A,Class C extends Class B.How will you call method doit
Difference between C++ and Java
Java and C++ are Object Oriented Programming (OOPs) language. Java... Anywhere / Write Once, Run Everywhere. C++ has multiple binary compatibility... programming and extends the C programming language. Java supports network computing
PHP Inheritance Class
Inheritance in PHP: Inheritance is a property of Object Oriented Programming, PHP also supports this principle in its programming as object model... in programming At the same time we must keep in our mind that when we should
Object Oriented concepts
OOP stands for Object Oriented Programming. This is a technique used to develop programs revolving around the real world entities. In OOPs programming... on the following links Object Oriented concepts
programming concept
programming concept  Write a program that allows the user to input a total dollar amount for an online shopping order and computes and outputs the shipping cost based on the following schedule
What is attribute oriented programming?
What is attribute oriented programming?  Hi, What is attribute oriented programming? Thanks
OOPs and Its Concepts in Java
certain things common. In object oriented programming classes can inherit some...;    Brief Introduction to OOP Object Oriented Programming or OOP is the technique to create programs based on the real world
java : object oriented
java : object oriented   (a) Write a class named CarRental... and their relationship. (c) Write an application named UseCarRental that prompts... for above two classes and their relationship. (c) Write an application named
fully object oriented language - Java Beginners
fully object oriented language  Is java is a fully object oriented language?if no,why?  Hi Friend, Java is not a fully object oriented... multiple inheritance. 3)It allows static methods to call without creating
Java Object
Java Object         Object is the basic entity of object oriented programming language. Object.../java/master-java/java-object-oriented-language.shtml  
c++ programs
c++ programs  i want the syntax for the following programs according to c++ pattern. 1.sum of multiples of an integer upto 10 2.2/4+4/6+6/8+8/10+.....n/n+2 3.1!/1+2!/2+3!/3+4!/4+...n!/n i just want the main logic as i m nt
Java7 : OOPs Concepts
JAVA7 : OOPs Concept In this section we will discuss concept of Object oriented programming. Object Oriented Programming : Object Oriented Programming, better termed as OOPs is a paradigm where everything is represented as an object
c++ programs
c++ programs  Write a program with the following (a) A function to read two double type numbers from keyboard (b) A function to calculate the division of these two numbers (c) A try block to throw an exception when a wrong type
c++ programs
c++ programs  Write a program with the following (a) A function to read two double type numbers from keyboard (b) A function to calculate the division of these two numbers (c) A try block to throw an exception when a wrong type
multiple inheritance - Java Beginners
multiple inheritance  Why java does not support Multiple Inheritance...)why java classes does not support Multiple Inheritance? JAVA CLASSES ONLY... Inheritance. Ans...>java classes doesn't support multiple inheritance,the practical
write a program to demonstrate wrapper class and its methods......
write a program to demonstrate wrapper class and its methods......  write a program to demonstrate wrapper class and its methods
Inheritance
that is already made. It is one of the most important feature of Object Oriented Programming. It is the concept that is used for reusability purpose. Inheritance...; To know the concept of inheritance clearly you must have the idea of class and its
C Programming
C Programming  hi,how can i write a program in C programming to place reservation in air plane from the menu let the user to inter his/her gender(W or M)and draw seats by using ascii codes and choose where he/she will sit
OOPs concepts in Java
Object-Oriented Programming (OOPs) concepts in Java helps in creating programs...: Class Object Inheritance Encapsulation Abstraction... data and behavior of an object in a class. Encapsulation also hides any
Multiple Inheritance Problem - Java Beginners
Multiple Inheritance Problem  Hello Friend why Multiple Inheritance... methods i. void show() in 3 super-classes named as A,B,C and if i extends A,B,C... i.e void show(int a),void show(int b,int c) and void show(int d,int e,int f

Ads