The Maw

Join the Ultimate Halo forum. Explore the inner depths of the Halo Megastructure, and realize your true potential as the savior of humanity
 
HomePortalGalleryFAQSearchRegisterMemberlistUsergroupsLog in

Share | 
 

  Inheritance

View previous topic View next topic Go down 
AuthorMessage
meodingu
Kig 'Yar
Kig 'Yar


Male
Number of posts : 141
Age : 31
Registration date : 2010-10-13

PostSubject: Inheritance    Tue Jan 11, 2011 9:00 am

Inheritance
Inheritance allows one data type to acquire properties of other data types. Inheritance from a base class may be declared as public, protected, or private. This access specifier determines whether unrelated and derived classes can access the inherited public and protected members of the base class. Only public inheritance corresponds to what is usually meant by "inheritance". The other two forms are much less frequently used. If the access specifier is omitted, a "class" inherits privately, while a "struct" inherits publicly. Base classes may be declared as virtual; this is called virtual inheritance. Virtual inheritance ensures that only one instance of a base class exists in the inheritance graph, avoiding some of the ambiguity problems of multiple inheritance.
Multiple inheritance is a C++ feature not found in most other languages. Multiple inheritance allows a class to be derived from more than one base class; this allows for more elaborate inheritance relationships. For example, a "Flying Cat" class can inherit from both "Cat" and "Flying Mammal". Some other languages, such as Java or C#, accomplish something similar (although more limited) by allowing inheritance of multiple interfaces while restricting the number of base classes to one (interfaces, unlike classes, provide only declarations of member functions, no implementation or member data). An interface as in Java and C# can be defined in C++ as a class containing only pure virtual functions, often known as an abstract base class or "ABC". The member functions of such an abstract base classes are normally explicitly defined in the derived class, not inherited implicitly.


hotel booking
transfer factor
Back to top Go down
View user profile
 
Inheritance
View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
The Maw :: Off Topic :: General Discussion-
Jump to: