Hi, as i mentioned earlier… the "not having" create a couple of problems:
1. the "void-pointer-inflation"
you can rewrite "method_base(struct base* hdl, ...)" win
"method_base(void* hdl, ...)" this seems to solve the problem
BUT you definitely loos the type-check because other pointer as "A"
and "B"
also allowed.
2. the "cast inflation"
you can add the "CPP" wrapper to "method_base" this will act like
"void*"
but you loose the "type-check also"
3. even if you use "&aObj->obj" this create EXTRA CODE which add only
CRASH-scenarios
and add EXTRA overhead…
3. there is only ONE clear solution which NOT loose the "type-checking"
and DON'T add
extra code and this solution is the "frienddef"
mfg AO
On 03.02.20 10:20, J Decker wrote:
On Mon, Feb 3, 2020 at 1:10 AM aotto <aotto1968@xxxxxxxxxxx
<mailto:aotto1968@xxxxxxxxxxx>> wrote:
On 03.02.20 10:07, J Decker wrote:
> On Mon, Feb 3, 2020 at 12:23 AM aotto <aotto1968@xxxxxxxxxxx
<mailto:aotto1968@xxxxxxxxxxx>> wrote:
>
>> Hi,
>>
>> there is an easy test, if Stefan is right and I'm wrong.
>>
>> 1. cast an INVALID Pointer to "aObj"
>>
> how would friend prevent an invalid pointer pass?
→ I have a pointer-type-and-valid test in my software, this mean
I know if a pointer is "valid" or not... but this works only if
I get the pointer into my "base_method".
C doesn't have any such thing, no do any other developer, so how would
it help them? (you fell off the list)