After spending around 5 hours on this, I found some of the following interesting features:
- In C++, whenever you create a Win Form project (all I know beside Win32 Console right now), you will automatically have a stdafx.h & stdafx.cpp to do the standard #include operation for all the code file. Any special #include can be implemented in stdafx.h
Sample:
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
#pragma once
// TODO: reference additional headers your program requires here
//#include <string>
#include "SimpleException.h" - Class ends with ";" (semi-colon). I forgot about that and wasted a few hours.
- C++ can also have garbage collection like C#. Fot that, you must follow a special syntax called "managed C++":
ref class SimpleException
{
public:
//constructor
//default
SimpleException(String^);
//accessor
//get error message
String ^GetError();
private:
String ^_errMsg;
} - In managed C++, instead of using value typed variables, the code uses handler (which is still different from unmanaged C++), something like pointer. However, instead of using the asterisk character (*), we use the caret character '^' to denote these managed objects. Plus when declaring structures & classes, we also use the "ref" keyword (since all the structure / classes are "handler" by definition)
Download
No comments:
Post a Comment