Class pointers

Started by
10 comments, last by Zoot 21 years, 3 months ago
quote:Original post by Zoot
NuffSaid, i want to create instantiate of the class later using the classlist.

Yes, LordShade class *classlist[128]; is legal.


I should have read the first post more closely. You will have to do runtime typing.

Also, I believe "class" is a keyword that ultimately compiles out to mean structure. Thus,

class* classlist[128]

is compiled out to

structure* classlist[128]

which means you don''t have a type defined so the compiler has no idea what type you are asking to store. Sure it can allocate the storage, a pointer is a pointer no matter what, but trying to assign something to it, well now, that''s when the compiler sits up and goes, "HUH!?"
Advertisement
Zoot - C++ supports (currently ? Oh, please! Please! *beg* *grovel* Gimme! Please! )neither reflexion nor metaclasses. You can, however implement an abstract factory. See also this link in the C++ FAQ-Lite.

[ Start Here ! | How To Ask Smart Questions | Recommended C++ Books | C++ FAQ Lite | Function Ptrs | CppTips Archive ]
[ Header Files | File Format Docs | LNK2001 | C++ STL Doc | STLPort | Free C++ IDE | Boost C++ Lib | MSVC6 Lib Fixes ]

[edited by - Fruny on December 31, 2002 3:50:27 AM]
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan

This topic is closed to new replies.

Advertisement