THE C Programming Model Directly Supports Three Programming Paradigms:
The procedural model as programmed in C, and, of course, supported within C An example of this is string manipulation using character arrays and the family of str * functions defined in the Standard C library:. Char boy [] = "Danny";
Char * p_son;
...
p_son = new char [strlen 1];
STRCPY (p_son, boy);
...
IF (! Strcmp (p_son, boy))
. Take_to_disneyland (boy); The abstract data type (ADT) model in which users of the abstraction are provided with a set of operations (the public interface), while the implementation remains hidden An example of this is a String class: String girl = "Anna";
String daughter;
...
// String :: Operator = ();
Daughter = Girl;
...
// String :: operator == ();
IF (girl == daughter)
take_to_disneyland (girl); The object-oriented (OO) model in which a collection of related types are encapsulated through an abstract base class providing a common interface An example of this is a Library_materials class from which actual subtypes such as Book, Video,. Compact_disc, Puppet, And Laptop Are Derived: Void
Check_in (library_materials * pmat)
{
IF (pmat-> late ())
PMAT-> FINE ();
PMAT-> check_in ();
IF (lender * plend = PMAT-> reserved ())
PMAT-> Notify (PLEND);
} C supports polymorphism through class pointers and references. This style of programming is called object-oriented.C also supports a concrete ADT style of programming now called object-based (OB) -nonpolymorphic data types, such as a String class.