Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
L

Li Lirong

@Li Lirong
About
Posts
8
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • WTL DDX with controls, really?
    L Li Lirong

    You can try CContainedWindowT. Regards, Lirong

    ATL / WTL / STL question c++ learning

  • stl and sprints/sscans
    L Li Lirong

    Hi, There is an article by Sutter on this issue. If you are interested, you can read it here: http://www.gotw.ca/publications/mill19.htm Also, there is an experimental c++ string format library (It is accepted by the boost organizers) : http://groups.yahoo.com/group/boost/files/format2/ Regards, Lirong

    ATL / WTL / STL c++ json help tutorial announcement

  • member functions vs. non-member functions
    L Li Lirong

    >Not in the real world. Why? In his articles, Scott gave reasons for his argument --- non-member functions can improve encapsulation. If the reasons are valid, why it is not practical in the real world? If those reasons are not valid, why they are not? Regards, Lirong

    The Lounge visual-studio com algorithms oop question

  • member functions vs. non-member functions
    L Li Lirong

    Hi, all, What's your opinions on Scott Meyers' article: How Non-Member Functions Improve Encapsulation In that article, he gave the following algorithm: if (f needs to be virtual) { make f a member function of C; } else if (f is operator>> or operator<< ) { make f a non-member function; if (f needs access to non-public members of C) { make f a friend of C; } } else if (f needs type conversions on its left-most argument) { make f a non-member function; if (f needs access to non-public members of C) { make f a friend of C; } else if (f can be implemented via C's public interface) { make f a non-member function; } else { make f a member function of C; } Do you agree with this algorithm? Regards, Lirong

    The Lounge visual-studio com algorithms oop question

  • What's wrong with my code? (class template)
    L Li Lirong

    Thank all.

    ;)

    I have try it in C++ Builder. It runs well there.

    I could have defined the function within the class declaration. However, I am not able to do that. The reason is illustrated by the following example. In the example, A<T>::nested uses B<T> and B<T>::nested used A<T>.

    // begin of A.h
    #pragma once

    // foreword declaration, but we still can not use class B.
    //that is why I can't put the definition of A<T>::nested::test() inside the declaration;

    template <class T> class B;

    template <class T> class A

    {

    public:

    class nested

    {

    public:

    void test(B<T> b);

    };

    nested GetNested() const

    {

    return nested();

    }

    }

    #include A.imp

    // end of A.h

    <

    C / C++ / MFC c++ help question

  • _beginthread and MFC
    L Li Lirong

    I would suggest you to read one of newcomer's articales: http://www.pgh.net/~newcomer/callbacks.htm ;) Lirong

    C / C++ / MFC c++ question

  • What's wrong with my code? (class template)
    L Li Lirong

    Thanks. ;) I have made some correctness on my question; Yes, If I write the definition of "test" of the nested class within the class declaration, it does work. So my question is: Is it possible to separate the definition and declaration of a function of a nested class ( which is nested in a template ). Is there anything wrong with my syntax? Or it is just because of the compiler(vc++6)? Thanks. Lirong

    C / C++ / MFC c++ help question

  • What's wrong with my code? (class template)
    L Li Lirong

    I have the following codes, all of them are in the same file "test.cpp" //declaration template <class T> class temp { public:     class nested         {         public:             void test();         };     void test()     {         nested nes;         nes.test();     } }; //definition template <class T> void temp<T>::nested::test() {} int main( /* int argc, char* argv[] */ ) {     temp<int> tem;     tem.test();     return 0; } error message: test.obj : error LNK2001: unresolved external symbol "public: void __thiscall temp<int>::nested::test(void)" (?test@nested@?$temp@H@@QAEXXZ) test.exe : fatal error LNK1120: 1 unresolved externals what's wrong with my code? thanks :(( Lirong

    C / C++ / MFC c++ help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups