5

Does C language support inheritence. If so is is it using structures as classes are not defined in C.

Daniel Daranas
  • 22,082
  • 9
  • 61
  • 111
ckv
  • 10,125
  • 19
  • 96
  • 139

10 Answers10

11

Yes, it does. See http://gcc.gnu.org/ml/gcc/2010-05/msg00725.html . See Axel-Tobias Schreiner's book Object-Oriented Programming with ANSI C. There's an English translation of it available.

Also, see Object-orientation in C and How can Inheritance be modelled using C? .

Community
  • 1
  • 1
Yktula
  • 13,526
  • 14
  • 45
  • 70
8

No it doesnt. C is not an Object Oriented language. Inheritance is a property of OO languages.

You should try C++. It's OO and supports much more than inheritance

Midhat
  • 16,940
  • 19
  • 85
  • 114
6

No, it doesn't.

SLaks
  • 837,282
  • 173
  • 1,862
  • 1,933
4

There is no Compiler-level support for inheritance in C. Nevertheless, as others have already pointed out, Object Oriented coding does not REQUIRE such support. However, its a lot easier to write OO code in C++.

swestrup
  • 4,071
  • 3
  • 21
  • 30
3

C inherits from ALGOL C Programming Language

Khorkrak
  • 3,779
  • 1
  • 26
  • 34
1

C is not an Object Oriented language. Inheritance is a property of Object Oriented languages. There is no Compiler-level support for inheritance in C. Object Oriented coding does not REQUIRE such support.

geetha
  • 69
  • 1
  • 5
0

No it doesn't support inheritance because C language is not oops

Dharmesh Rakholia
  • 1,170
  • 7
  • 19
0

No it doesn't. C is not an Object Oriented language. You can try C++ or Java for inheritance functionality.

KDV
  • 1
  • 2
0

C is not an object oriented language as inheritance is supported only in object oriented programming language C doesn't support inheritance

vasu
  • 1
0

well, c is NOT OBJECT ORIENTED language so,it is not available in C

Android
  • 8,757
  • 9
  • 65
  • 108