S
S
Sergey2011-04-07 18:52:29
C++ / C#
Sergey, 2011-04-07 18:52:29

Accessing non-existing object properties

Actually, there was such a problem. There is some object Foo . It has getter and setter getBar / setBar respectively. Is it possible somehow to overload the -> operator to replace these functions? Yes, something like PHP's __get / __set method .
C C ++ is familiar rather superficially, therefore, such a question arose. My knowledge of overloading and working with the -> operator ends with container dereferencing.

ps It is necessary simply, so to speak, for yourself. For the sake of learning.

Updated
www.rsdn.ru/forum/cpp/2265191.1.aspx - everything I found on this topic. Basically what I need.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dzuba, 2011-04-07
@Dzuba

If for Visual C ++, then there is such an option: msdn.microsoft.com/ru-ru/library/yhfk0thd.aspx

M
mark_ablov, 2011-04-07
@mark_ablov

I use the wiki article when I want to know the availability of operators for overloading (not to climb into the standard).
Judging by this page, this is not available.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question