C ++ enters the features oriented to (OO object to C. He offers classes which provide four features of language: abstraction, hermetic sealing, inheriting and polymorphism. Objects are cases of the classes created in execution time. Think of a class as about the template from which various individual objects as the program runs can be made many.
Hermetic sealing
Hermetic sealing - information hiding. C ++ carries out hermetic sealing, resolving all members of a class to be declared or as public, private, or protected. The public member of a class is accessible to any function. The member of parliament who is not occupying an official post is accessible only to functions which are members of that class and to functions and classes to which the permission to access in given a class ("friends") is obviously given. The protected participant is accessible to members of classes who inherit a class in addition to a class to directly and any friends.
Principle OO is that all functions (and only functions), accessible to a type internal form, should be concluded in a capsule within a type definition. C ++ supports it (through functions of the participant and function of the friend), but does not put into practice: the programmer can declare, that parts or all representation of type are public, and to allow to promulgate legal bodies who are not a part of representation of type.
It in general consider as good practice to make all data private or protected, and to promulgate only those functions which are a part of the minimum interface for users of a class. It hides all details of performance of data, resolving the designer after essential change performance, not changing the interface in any case.
Inheriting
Inheriting allows one data type to gain properties of other data types. Inheriting from a base class can be declared as the public protected, or private. This qualifier of access defines, whether can to get the disconnected and received classes access to the inherited public and protected members of a base class. Only public inheriting corresponds to that usually intends "inheriting". Other two forms are used much less often. If the access qualifier is omitted, inheriting as it is supposed, private for a basis of a class and the public for a basis struct. Base classes can be declared as real; it name the real inheriting. The real inheriting guarantees, that only one case of a base class exists in a descendance graph, avoiding some of problems of a doublemeaning of multiple inheritance.
Multiple inheritance - C ++ is feature which sometimes consider the disputable. Multiple inheritance allows a class to be received of more than one base class; it can lead to a difficult elational graph of inheriting. Some other languages, such as Java or C #, reach something similar (though more limited), allowing inheriting of multiple interfaces, limiting number of base classes to one (interfaces, unlike classes, provide only declarations of functions of the participant, any performance or data of the participant).
dating girls Darlington - So. so need tell about wide flare jeans so u'd click up. It's yours. - replica watches
|