• Content count

  • Joined

  • Last visited

Community Reputation

134 Neutral

About jmau0438

  • Rank
  1. Are/Should Factory's always singletons?
  2. Hey all. I would like to use some of my C++ libraries in AS 3.0. Nothing to over the top, sticking primarily to data manipulation. I've brought native C/C++ into Visual Basic & C# before, but its a little more involved with Flash. I did a bit of homework and found this thing called "Alchemy", I was wondering if anyone has heard of it and if anyone knew of any more simple and/or direct methods of achieving the desired ends. Any additional information on the subject would be appreciated.
  3. Just getting started, got some questions

    I agree with "oler1s", you need to program simpler things first. Try laboring towards smaller projects, like a tool or something. In the end it could be just a windowed app (which is pretty easy in VS), but you could enforce some constraints that up the challenge. Once you have COMPLETED some stuff, it'll definitely give you some insight on what your trying to do and what its going to take to do it. Thinking of a premise is one thing, making it happen is another.
  4. Generally yes, or even information that would assist with template parameters or member access. I figured it would be a try catch throw thing (though I'll try to restrict the code for such things to debug)
  5. Any helpful tips and/or guidelines ( "do's and don'ts" ) would be helpful as well
  6. Just a general question to the community, but can anyone show me how to catch certain errors and provide more helpful/descriptive messages in the output/error list tabs in Visual Studio C++. Any help would be appreciated.
  7. Can anyone give me a simple example on how you return a polymorphic pointer?
  8. Problems with Polymorphism

    Nice solution, thanks. I'll give that a shot
  9. Problems with Polymorphism

    I noticed that I did not initialize it, so I did. Error persists... NewOperation < TYPE, T > *Ref = new NewOperation < TYPE, T >; this->Op_ptr = dynamic_cast < Operation < TYPE, T > * > ( Ref );
  10. OK, this is a loaded question, so here I go. Objective: Up-cast a base object into a derived one Break-Down: Each object is a function object, meaning an object containing a single member function with a single argument. The hierarchy is as follows: 1)Function Object: Template Interface, contains a single virtual method called execute template < typename TYPE, typename T > __interface iFunctionObject { public: virtual TYPE Execute ( T ) = 0; }; 2)Strategy Object: An Abstract Interface derived from Function Object, member function remains virtual as it is not defined. Its purpose is primarily cosmetic as it helps in defining a common set of terminology. template < typename TYPE, typename T > __interface iStrategy : public iFunctionObject < TYPE, T > {}; 3)Context Specific Definition: From iStrategy one last derived class is defined. Member function remains virtual with the only real change being an alias for the data to referenced within the member function and a default implementation that simply returns zero. template < typename TYPE, typename T > class Operation : public iStrategy < TYPE, T > { public: virtual TYPE Execute ( T Stuff) { return 0; }; }; 4)Implementation: From this point I derive from "Operation" and overload the virtual function in each child object in order to perform a collection of algorithms, each require a single argument and return a value as specified in the template parameters. 5)Control Object: The controlling object possesses a data member that is an Operation Pointer. This pointer is meant to be Up-Casted into a specified Operation derivative. I'll spare you the details, but it involves a collection of enumerated values and a switch. PROBLEM: When I attempt to Up-Cast like so: NewOperation < TYPE, T > *Ref; this->Op_ptr = dynamic_cast < Operation < TYPE, T > * > ( Ref ); This code compiles but crashes at run-time when invoking the "Execute" member function because it cannot locate it within the newly casted operation pointer. Can anyone help me with this?
  11. I'm having trouble with inheriting from an interface-to-abstract class to a template class. (Using VSC++ 2005) I have an interface object, for simplicity we'll call it state and I'll stick to one function, which would go something like this: (This is a hacked example so forgive syntax errors) __interface iState { public: virtual void InternalState ( void ) = 0; } Then in an abstract interface I define the function signature (notice that I overload it): template < typename TYPE > class AbstractState abstract : public iState { private: TYPE _InternalState; public: virtual void InternalState ( const TYPE Data ) { _InternalState = Data; }; virtual TYPE* InternalState ( void ) { return _InternalState; }; } And finally I overload the function calls in a standard template object and intentionally overload the function to avoid this error (even though it should never occur when inherited publicly): template < typename TYPE > MyState : public AbstractState < TYPE > { public: void InternalState ( const TYPE Data ) { _InternalState = Data; }; TYPE* InternalState ( void ) { return _InternalState; }; } Can anyone tell me where I'm still causing this error?
  12. Attention to detail is important, but jesus christ fellas, let it go!
  13. Otreum, though it is wise to gain an understanding of the syntax of any computer language you intend to work with, know that the details of the language are specific unto itself, whereas the techniques behind it are not. A common mistake made by many aspiring engineers (and even some of the older ones) is in the obsession of a given language. Place more emphasis on engineering techniques and less on the syntax. The more you use a language the more familiar you will be with it. In light of this truth if the trade, I recommend "Design Patterns: Elements of Reusable Object-Orientated Code". Good Luck.