locked
Basic Command Syntax RRS feed

  • Question

  •  

    As you can see from the tital, I am verry verry verry x100 new to this language. IF sombody could help me to make the transition from VB syntax to C++ Syntax that would be great. I would just like to know about a few basic concepts.

     

    How to declare a variable public and private

    How to set a boolean value

    How to set properties in code

    Basic Command Syntax.

     

     

    Thanks a bunch.

     

    Andrew DeVaughn

    Tuesday, August 14, 2007 1:47 AM

Answers

  • I suggest you go get yourself a good startup book. That will save you a lot of time and head-scratching. There's a free e-book available at http://www.mindview.net/Books/DownloadSites, should you want one right away. Otherwise, I'd recommend "Accelerated C++".

    Answering your question, though:

    class MyClass
    {
    public:
      bool myPublicVariable;

      void myFunction()
      {
        myPublicVariable = true;
        myPrivateVariable = false;
      }

    private:
      bool myPrivateVariable;
    };

    int main()
    {
      MyClass m;
      m.myFunction();
      m.myPublicVariable = false;
    }


    What you will find is that C++ and Visual Basic is two very different languages, so using one to make sense of the other is largely not a good idea. Most of the concepts differ, including the ones you've listed in your question. Again, I urge you to get a book. That would bring you up to speed quicker Smile
    Tuesday, August 14, 2007 7:18 AM