Re[5]: За что я не люблю С++
От: 0xC0000005  
Дата: 01.06.09 12:18
Оценка: -2
Здравствуйте, criosray, Вы писали:

C>Здравствуйте, CreatorCray, Вы писали:


C>>>Множественное наследование такой же моветон, как и goto.

CC>>Какое смелое заявление.
C>Это факт.
C>http://c2.com/cgi/wiki?MisUsingMultipleInheritance
C>http://www.gotw.ca/publications/mill06.htm


C>

C>Scott Meyers is one of the leading gurus in the C++ languages, in his book "Effective C++", the "is a" relationship for public inheritance is being mentioned in item 35: Make sure public inheritance models "is a".

C>Beside that, the current chairman of the ISO C++ Standard Committee, Herb Sutter, have also mentioned that in one of his articles.


C>We need "controlled polymorphism" LSP IS-A, but in certain code only. Public inheritance should always model IS-A as per the Liskov Substitution Principle (LSP).[3] Nonpublic inheritance can express a restricted form of IS-A, even though most people identify IS-A with public inheritance alone. Given class Derived : private Base, from the point of view of outside code, a Derived object IS-NOT-A Base, and so of course can't be used polymorphically as a Base because of the access restrictions imposed by private inheritance. However, inside Derived's own member functions and friends only, a Derived object can indeed be used polymorphically as a Base (you can supply a pointer or reference to a Derived object where a Base object is expected), because members and friends have the necessary access. If instead of private inheritance you use protected inheritance, then the IS-A relationship is additionally visible to further-derived classes, which means subclasses can also make use of the polymorphism.


Многа букаф и ничего по существу.

C>>>>А как просто вам при вызове логгера указать текущее имя файла, исходника я имею ввиду,ай как вы ругали макросы, это так, это сяк, а как вы напишете:

C>>>>logger::log(__filename__, __line__, "log text")

C>>>
C>>>catch(Exception e) {
C>>>   Log.Error(e); // через рефлексию будет собрана информация об исключении, потоке, методе, сборке, стеке вызовов(!!!)
C>>>   throw;
C>>>}
C>>>


CC>>А ничего что то, что ты написал к logger::log(__filename__, __line__, "log text") не имеет вообще никакого отношения даже близко.

C>Конечно имеет. Но если хотите один в один, то ради бога:
C>Log.Info("log text");

А кто просил время выводить? По рукам, по рукам и никакой премии, хакер узнал лишнюю инфу из пользовательского лога, вы уволены.
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.