# C++ - Multiple Inheritance

In this sample, Shape is the base class. Triangle and Circle are the derived classes derived from the base class Shape. It is called inheritance.

class Cone is derived from both two base classes Triangle and Circle. It is called Multiple Inheritance.

## Source Code

class Shape

{

public:

Shape()

{

std::cout << "Shape\n";

}

virtual void draw() { };

virtual void display() { };

};

class Circle : public Shape

{

int r;

public:

Circle()

{

std::cout << "Circle\n\n";

}

virtual void draw() {};

virtual void display() { };

};

class Triangle : public Shape

{

int a,b,c;

public:

Triangle()

{

std::cout << "Triangle\n\n";

}

virtual void draw() {};

virtual void display() { };

};

class Cone : public Triangle, public Circle

{

public:

Cone()

{

std::cout << "Cone\n\n";

}

virtual void draw() {};

virtual void display() { };

};
{"ft_lang_label":"__label__en","ft_lang_prob":0.6593661,"math_prob":0.6488384,"size":840,"snap":"2021-21-2021-25","text_gpt3_token_len":206,"char_repetition_ratio":0.17224881,"word_repetition_ratio":0.19858156,"special_character_ratio":0.32023808,"punctuation_ratio":0.25925925,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9651004,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-05-16T20:39:54Z\",\"WARC-Record-ID\":\"<urn:uuid:a80a39f8-513d-41ba-81e5-0e539b2d046c>\",\"Content-Length\":\"34205\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:a7864556-90fe-453a-83ea-98bfd2c510cd>\",\"WARC-Concurrent-To\":\"<urn:uuid:725f3097-c060-46bb-922a-d9e42730664f>\",\"WARC-IP-Address\":\"151.106.38.72\",\"WARC-Target-URI\":\"http://www.softwareandfinance.com/OOPs/Multiple_Inheritance.html\",\"WARC-Payload-Digest\":\"sha1:OE2DUENSTWGXHXRV3IJVNTJGD2HZR3KE\",\"WARC-Block-Digest\":\"sha1:BSCT6GKAW2ZG24VESRUI3F5NH2TG6GAR\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-21/CC-MAIN-2021-21_segments_1620243989914.60_warc_CC-MAIN-20210516201947-20210516231947-00348.warc.gz\"}"}