Questions about C++

12/20/2009 18:34 Nullable#1
Hello elitepvpers members!
I have few questions about C++ and C++ integrated development environments and their comparison with C#:

List:

1. Are there any ides that contain the auto code list as most C# ides? e.g. C# - Microsoft Visual C# 2008 Express.

2. What are the main namespaces frequently used in C++? e.g in C# it is System namespace.

3. Are there any generic collections in C++? e.g C# - Dictionary<T Key, T Value>, List<T>.

4. Does C++'s definition for interfaces look like C#?

C# version :
<access modifier> interface <identifier>
{
// interface members
}

5. Socket class example in C++, if possible.

Thanks!
,Nullable
12/20/2009 20:08 ms​#2
1.
Not sure what you mean, but you can try the Visual C++ IDE.

2.
The C++ standard library uses namespace "std".

3.
[Only registered and activated users can see links. Click Here To Register...]

4.
don't know

5.
[Only registered and activated users can see links. Click Here To Register...]
12/20/2009 20:16 Nullable#3
1. Works perfectly, thanks.

4. Interfaces that can be inherited/implemented by classes, in C# i would declare an interface like this:

Code:
public interface IMyCalculator
{
     int Add(int a, int b);
     int Subtract(int a, int b);
     int Multiply(int a, int b);
     int Divide(int a, int b);
}
then i would declare a class that implements it:

Code:
public class MyClass : IMyCalculator
{

      int Add(int a, int b)
       {
           return (a + b);
       }

      int Subtract(int a, int b)
       {
           return (a - b);
       }
       
       // So on with other methods.
}
12/20/2009 20:36 Bl@ze!#4
Well maybe u mean this:

class MyClassOne
{
public:
MyClassOne(Parameter);
private:
int add(int a, int b); // etc etc
};

and then u can use myclassone in another like that:

class MyClass: public MyClassOne
{

};
12/21/2009 01:34 flo8464#5
Quote:
5. Socket class example in C++, if possible.
Google for "boost asio".
12/21/2009 01:54 backo#6
Quote:
Originally Posted by flo8464 View Post
Google for "boost asio".
I wouldn't suggest boost asio for beginners, the library is widely known for its over-engineering; thus I would go for [Only registered and activated users can see links. Click Here To Register...]
12/21/2009 13:57 Nullable#7
Thanks for help :}
12/21/2009 13:58 flo8464#8
It's better to learn to use asio properly.
If you know it, you will never have to learn any other communiction protocol lib again, you can extend asio to everything.

Another pro of boost is that every part of it is a candidate for the C++ standard.
12/21/2009 15:45 Nullable#9
Quote:
Originally Posted by flo8464 View Post
It's better to learn to use asio properly.
If you know it, you will never have to learn any other communiction protocol lib again, you can extend asio to everything.

Another pro of boost is that every part of it is a candidate for the C++ standard.
I am not efficient with C++ yet since i started about 2 weeks ago :} and i just wanted the Winsocket 2.0 class as a future reference
12/21/2009 19:50 backo#10
Quote:
Originally Posted by flo8464 View Post
It's better to learn to use asio properly.
If you know it, you will never have to learn any other communiction protocol lib again, you can extend asio to everything.

Another pro of boost is that every part of it is a candidate for the C++ standard.
I do agree with that part, however even "Bjarne Stroustrup" has stated that Boost does sometime over engineering, and thus is not usable for beginners. Most beginners even have problems setting up the libraries, using them is even harder, especially if you come from the .NET world.
12/22/2009 07:37 Nullable#11
Quote:
Originally Posted by backo View Post
I do agree with that part, however even "Bjarne Stroustrup" has stated that Boost does sometime over engineering, and thus is not usable for beginners. Most beginners even have problems setting up the libraries, using them is even harder, especially if you come from the .NET world.
Yeah i am having a hard time with those libraries, even scope and dot operators are still confusing me .. just if C# was cross-platform ..
12/22/2009 13:48 flo8464#12
Quote:
Originally Posted by Nullable View Post
Yeah i am having a hard time with those libraries, even scope and dot operators are still confusing me .. just if C# was cross-platform ..
Go for Python if you want a cross-platform C#.

C++ is different to C#, in positive and negative ways.
12/22/2009 15:20 Nullable#13
Quote:
Originally Posted by flo8464 View Post
Go for Python if you want a cross-platform C#.

C++ is different to C#, in positive and negative ways.
I don't really like Python since i found it quite annoying when using Blender, and as far i know C++ is better than C# if advantages and disadvantages are compared, best part is that i don't have to call so damn many DLLImports :} and by the way, i can not find a good example of signals and slots ..
12/22/2009 19:33 backo#14
Quote:
Originally Posted by Nullable View Post
I don't really like Python since i found it quite annoying when using Blender, and as far i know C++ is better than C# if advantages and disadvantages are compared, best part is that i don't have to call so damn many DLLImports :} and by the way, i can not find a good example of signals and slots ..
A lightweight implementation is avaible at: [Only registered and activated users can see links. Click Here To Register...] with a provided example; or you can check out [Only registered and activated users can see links. Click Here To Register...] .. get used to being redirected to boost, must have while developing in C++.. or [Only registered and activated users can see links. Click Here To Register...]