oop - what's interface vs. methods, abstraction vs. encapsulation in C++ -


I'm confused about such concepts when I talked with my friend.

My friend is of the opinion

1) The intangible net virtual function is about.

2) The interface is not a member function, but the interface is the pure virtual function.

I have found that in the C ++ primer, the interface is the type of operation that is the type of data support, so the member functions are the interface I

My opinion is

1) About intangible interface and implementation,

2) There are member work interfaces.

2) The difference between the interface and the member functions.

3) The difference between intangible and encapsulation.

I think your main problem is that you and your friend use the word "interface" -Using different definitions, so both of you are correct in different ways.

You are using the "interface" everyday in the sense of "with some inter-operated", like "the interface between my computer and my keyboard is USB" or "vacuum and wall power Interface is an outlet. "In this sense, yes, there are methods (even concrete ones) interfaces, because they define the way to inter-operate with an object. It is not to say that it is not applicable to the software - it is the spirit of the "interface" used in the application interface (API).

Your friend is using a more specific "interface" object-oriented programming terminology, meaning "a different set of operations, that can choose to provide a category guarantee that it will support ". Here, the definitionistic feature of an "interface" is that it has no implementation of its own, a class must support the interface by implementing the methods set by the interface. Since there is no clear concept of an interface in this sense in C ++, then equivalent construction is a class with only one pure virtual functions (aka a summary data type). "Abstract", on the other hand, many things, and then both of you are correct. In general, abstract sense means the ability to focus on high-level concepts rather than low level details. Encapsulation is a type of abstract because its purpose is to hide the details of the implementation of class methods; The implementation class can change without changing the definition. Pure virtual functions ("interface" in oo-coded sense) are another type of intangible because they can be used properly, not only hide the implementation but also the actual underlying object type; The type of being used can change as long as both types do not apply the same interface.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -