| Learning C++ |
[04 Feb 2004|04:14pm] |
I've been programming in php for some 3 years now, and I figured it was time to start learning a client-side, 'real' language.
I understand the basics of programming, but I don't see a whole bunch of really good tutorials online. They do great to teach you the syntax, but nothing to explain how to really use the language, no real-world examples, etc.
Anyway, to push myself a bit, I've been trying to code my first 'useful' program - a utility that will convert bytes to Kilobytes to Megabytes to Gigabytes and anything inbetween. Right now it's using a menu (ech) instead of arguments, but I'm not that good yet.
Well, it's not working. I was wondering if anyone could point out to me why. I'm not even sure if I'm using the correct variable types...
Anyway, it's here. Any suggestions would be appreciated. I've been putting off trying to get someone to help to see if I can figure it out, but I'm just at a loss now.
Is there any good online tutorials that teach you the language, while showing example programs that are actually useful?
|
|
| msvc6 vs. g++ template problem |
[04 Feb 2004|06:47pm] |
msvc6 allows the following code:
template<typename t_interface, typename t_impl = t_interface::impl_default>
class CImpl
{
...
};
where t_interface::impl_default is a typedef, like:
class ITest
{
public: typedef class CTest impl_default;
public: typedef class CTestOther impl_other;
...
};
(so an instantiation might look like one of:)
CImpl<ITest, CTest> Default;
CImpl<ITest> DefaultAgain;
CImpl<ITest, ITest::impl_default> DefaultYetAgain;
CImpl<ITest, ITest::impl_other> Other;
however, g++ doesn't like "typename t_impl = t_interface::impl_default". it doesn't seem to let me "access" the typedef in t_interface in the template declaration. is there any way to get what i want in a portable manner? (allow CImpl to access something scoped inside t_interface in the default declaration of t_impl?)
|
|