mirror of
https://github.com/boostorg/openmethod.git
synced 2026-01-19 16:32:12 +00:00
Compare commits
3 Commits
copilot/ad
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f53122eae8 | ||
|
|
41eaec5bef | ||
|
|
5796d3c3ea |
@@ -14,5 +14,5 @@ BOOST_OPENMETHOD_OVERRIDE(
|
||||
return 5000.0;
|
||||
}
|
||||
|
||||
BOOST_OPENMETHOD_CLASSES(Employee)
|
||||
BOOST_OPENMETHOD_CLASSES(Employee);
|
||||
// end::content[]
|
||||
|
||||
@@ -14,6 +14,6 @@ BOOST_OPENMETHOD_OVERRIDE(
|
||||
return next(emp) + emp->sales * 0.05; // base + commission
|
||||
}
|
||||
|
||||
BOOST_OPENMETHOD_CLASSES(Employee, Salesman)
|
||||
BOOST_OPENMETHOD_CLASSES(Employee, Salesman);
|
||||
|
||||
// end::content[]
|
||||
|
||||
@@ -12,5 +12,5 @@ BOOST_OPENMETHOD_DEFINE_OVERRIDER(
|
||||
return 5000.0;
|
||||
}
|
||||
|
||||
BOOST_OPENMETHOD_CLASSES(Employee)
|
||||
BOOST_OPENMETHOD_CLASSES(Employee);
|
||||
// end::content[]
|
||||
|
||||
@@ -16,4 +16,4 @@ BOOST_OPENMETHOD_OVERRIDE(
|
||||
}
|
||||
// end::content[]
|
||||
|
||||
BOOST_OPENMETHOD_CLASSES(Employee, Salesman)
|
||||
BOOST_OPENMETHOD_CLASSES(Employee, Salesman);
|
||||
|
||||
@@ -7,5 +7,5 @@
|
||||
#include "roles.hpp"
|
||||
#include <boost/openmethod.hpp>
|
||||
|
||||
BOOST_OPENMETHOD_CLASSES(Employee)
|
||||
BOOST_OPENMETHOD_CLASSES(Employee);
|
||||
// end::content[]
|
||||
|
||||
@@ -16,4 +16,4 @@ BOOST_OPENMETHOD_OVERRIDE(
|
||||
}
|
||||
// end::content[]
|
||||
|
||||
BOOST_OPENMETHOD_CLASSES(Employee, Salesman)
|
||||
BOOST_OPENMETHOD_CLASSES(Employee, Salesman);
|
||||
|
||||
@@ -7,5 +7,5 @@
|
||||
#include "roles.hpp"
|
||||
#include <boost/openmethod.hpp>
|
||||
|
||||
BOOST_OPENMETHOD_CLASSES(employees::Employee)
|
||||
BOOST_OPENMETHOD_CLASSES(employees::Employee);
|
||||
// end::content[]
|
||||
|
||||
@@ -17,7 +17,7 @@ BOOST_OPENMETHOD_OVERRIDE(
|
||||
emp->sales * 0.05; // base + commission
|
||||
}
|
||||
|
||||
BOOST_OPENMETHOD_CLASSES(employees::Employee, Salesman)
|
||||
BOOST_OPENMETHOD_CLASSES(employees::Employee, Salesman);
|
||||
|
||||
} // namespace sales
|
||||
// end::content[]
|
||||
|
||||
@@ -71,7 +71,7 @@ BOOST_OPENMETHOD_OVERRIDE(
|
||||
}
|
||||
|
||||
// ...and let's not forget to register the classes
|
||||
BOOST_OPENMETHOD_CLASSES(Employee, Salesman)
|
||||
BOOST_OPENMETHOD_CLASSES(Employee, Salesman);
|
||||
// end::overriders[]
|
||||
|
||||
// tag::main[]
|
||||
|
||||
@@ -66,7 +66,7 @@ BOOST_OPENMETHOD_OVERRIDE(
|
||||
}
|
||||
|
||||
// ...and let's not forget to register the classes
|
||||
BOOST_OPENMETHOD_CLASSES(Employee, Salesman)
|
||||
BOOST_OPENMETHOD_CLASSES(Employee, Salesman);
|
||||
// end::overriders[]
|
||||
|
||||
// tag::main[]
|
||||
|
||||
@@ -12,7 +12,10 @@ add_compile_definitions(BOOST_OPENMETHOD_ENABLE_RUNTIME_CHECKS)
|
||||
|
||||
add_library(boost_openmethod-shared SHARED extensions.cpp)
|
||||
target_link_libraries(boost_openmethod-shared Boost::openmethod)
|
||||
set_target_properties(boost_openmethod-shared PROPERTIES ENABLE_EXPORTS ON)
|
||||
set_target_properties(boost_openmethod-shared PROPERTIES
|
||||
ENABLE_EXPORTS ON
|
||||
OUTPUT_NAME shared
|
||||
)
|
||||
|
||||
add_executable(boost_openmethod-static static_main.cpp)
|
||||
target_link_libraries(boost_openmethod-static Boost::openmethod Boost::dll boost_openmethod-shared)
|
||||
@@ -36,7 +39,10 @@ add_library(boost_openmethod-indirect_shared SHARED indirect_extensions.cpp)
|
||||
target_compile_definitions(
|
||||
boost_openmethod-indirect_shared PUBLIC BOOST_OPENMETHOD_DEFAULT_REGISTRY=indirect_registry)
|
||||
target_link_libraries(boost_openmethod-indirect_shared PRIVATE Boost::openmethod Boost::dll)
|
||||
set_target_properties(boost_openmethod-indirect_shared PROPERTIES ENABLE_EXPORTS ON)
|
||||
set_target_properties(boost_openmethod-indirect_shared PROPERTIES
|
||||
ENABLE_EXPORTS ON
|
||||
OUTPUT_NAME indirect_shared
|
||||
)
|
||||
|
||||
add_executable(boost_openmethod-indirect indirect_main.cpp)
|
||||
target_compile_definitions(
|
||||
|
||||
@@ -6,7 +6,7 @@ An _open-method_ is a free-standing function that has one or more _virtual_
|
||||
_parameters_. When it is called, it forwards to an _overrider_ selected from a
|
||||
set by examining the dynamic types of the virtual parameters.
|
||||
|
||||
If this sounds like a virtual function, that's because because an open-method
|
||||
If this sounds like a virtual function, that's because an open-method
|
||||
with one virtual parameter is equivalent to a virtual function - with one big
|
||||
difference: it exists outside of classes.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user