Karachi GupShup

Karachi GupShup

Karachi GupShup
 
HomeGame ZoneFAQSearchMemberlistUsergroupsRegisterLog in

Share | 
 

  Inheritance

Go down 
AuthorMessage
meodingu
Member
avatar

Male Number of posts : 270
Pointz :
0 / 1000 / 100


PostSubject: Inheritance    Tue Jan 11, 2011 4:36 pm



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.

Französisch Übersetzungen
online math tutor
Back to top Go down
View user profile
 
Inheritance
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Karachi GupShup :: Karachi GupShup Information :: Welcome to Karachi GupShup-
Jump to: