answersLogoWhite

0

What does inheritance mean in c?

User Avatar

Anonymous

12y ago
Updated: 12/13/2022

The C Programming language doesn't actually support inheritance, it only supports composition. However, the following code demonstrates how we can use composition to approximate single inheritance:

struct Base {

int data;

};

struct Derived {

struct Base base;

// ...

};

int main (void) {

struct Derived d;

d.base.data = 42;

return 0;

}

User Avatar

Dane Bernhard

Lvl 10
2y ago

What else can I help you with?

Related Questions

What is an inheritance Explain different types of inheritance in c?

C is not an object oriented language and therefore has no native support for inheritance.


Why is multiple inheritance not possible in C?

C is not object-oriented -- you can't even use single inheritance let alone multiple inheritance.


How do you create multiple inheritance in c?

You don't. Inheritance is a feature of object oriented programming languages. C is not object oriented.


What is a relationship in following a-polymorphism b-inheritance c-overloading d-none of these options?

Inheritance.


What does staples mean by unwieldy inheritance?

mean an inheritance that is too heavy to bear.


How ploymorphism and inheritance is different from that in Java and c plus plus?

C++ allows multiple inheritance while Java does not. In my opinion, multiple inheritance is not useful because it can get very confusing very quick. For polymorphism, C++ does early binding by default, while Java does late binding by default. Late binding is more useful than early binding.


Specification forms of inheritance in java?

single level inheritance eg ( class B extends Class A) Multilevel inheritance eg( class C extends class B and class B extends class A) multiple inheritance Class C inherits Class A features as well as Class B featues.This type of inheritance is not allowed in JAVA.


Does c plus plus supports hierarchical inheritance?

Yes.


What is multiple inheritence in c?

C is not object oriented and therefore has no concept of inheritance of any kind.


What is the difference between class inheritance and interface inheritance?

interface inheritance is a misleading term. Interface inheritance would be equivalent to the union of the method signatures of interfaces ( no typo here, an interface may implment multiple other interfaces) Class inheritance - single hierarchy (in C#), and not only the methods are inherited, but also the data members. (interface in C# cannot define data members)


What is problem in multiple inheritance?

Java does not support direct multiple Inheritance. Harder to implement, not every language support it: C++ does, Java does not.


What has the author E C Macdowell written?

E C. Macdowell has written: 'Size inheritance in rabbits'