class CLASS1 {
...
};
class CLASS2 {
private:
CLASS1 pt;
...
};
and then in the constructor i would allocate memory for pt..is that alright? i am asking because i dont want to be doing something absurd..
thanks
[blocks are apparently case sensitive]
[edited by - Magmai Kai Holmlor on April 18, 2003 12:33:44 AM]
class in other class
is it alright to have a pointer to another class as a member of another class?
in code:
Yeah, having pointer is fine, though you might want to consider using a smart pointer. It''s just easier iff you use the right type of smart pointer, the ones in boost are probably the easiest to use.
However, naming classes in ALLCAPS is bad style (it''s legal code though). Traditionally, ALLCAPS is reserved for MACROS_ONLY.
- Magmai Kai Holmlor
"Nobody will listen to a stone no matter how hard you throw it."
[Look for information | GDNet Start Here | GDNet Search Tool | GDNet FAQ | MSDN RTF[L] | SGI STL Docs | STFW | Asking Smart Questions ]
[Free C++ Libraries | Boost | ACE | Loki | MTL | Blitz++ | wxWindows| Spirit(xBNF)]
[Free C Libraries | zlib ]
However, naming classes in ALLCAPS is bad style (it''s legal code though). Traditionally, ALLCAPS is reserved for MACROS_ONLY.
- Magmai Kai Holmlor
"Nobody will listen to a stone no matter how hard you throw it."
[Look for information | GDNet Start Here | GDNet Search Tool | GDNet FAQ | MSDN RTF[L] | SGI STL Docs | STFW | Asking Smart Questions ]
[Free C++ Libraries | Boost | ACE | Loki | MTL | Blitz++ | wxWindows| Spirit(xBNF)]
[Free C Libraries | zlib ]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement