|
You last visited: Today at 01:55
Advertisement
Questions about C++
Discussion on Questions about C++ within the C/C++ forum part of the Coders Den category.
12/20/2009, 18:34
|
#1
|
elite*gold: 0
Join Date: Nov 2009
Posts: 390
Received Thanks: 321
|
Questions about C++
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
|
#2
|
elite*gold: 115
Join Date: Oct 2007
Posts: 9,390
Received Thanks: 12,344
|
1.
Not sure what you mean, but you can try the Visual C++ IDE.
2.
The C++ standard library uses namespace "std".
3.
4.
don't know
5.
|
|
|
12/20/2009, 20:16
|
#3
|
elite*gold: 0
Join Date: Nov 2009
Posts: 390
Received Thanks: 321
|
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
|
#4
|
elite*gold: 240
Join Date: Dec 2006
Posts: 1,579
Received Thanks: 1,609
|
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
|
#5
|
elite*gold: 0
Join Date: Nov 2008
Posts: 161
Received Thanks: 38
|
Quote:
5. Socket class example in C++, if possible.
|
Google for "boost asio".
|
|
|
12/21/2009, 01:54
|
#6
|
elite*gold: 0
Join Date: Sep 2006
Posts: 248
Received Thanks: 110
|
Quote:
Originally Posted by flo8464
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
|
|
|
12/21/2009, 13:57
|
#7
|
elite*gold: 0
Join Date: Nov 2009
Posts: 390
Received Thanks: 321
|
Thanks for help :}
|
|
|
12/21/2009, 13:58
|
#8
|
elite*gold: 0
Join Date: Nov 2008
Posts: 161
Received Thanks: 38
|
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
|
#9
|
elite*gold: 0
Join Date: Nov 2009
Posts: 390
Received Thanks: 321
|
Quote:
Originally Posted by flo8464
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
|
#10
|
elite*gold: 0
Join Date: Sep 2006
Posts: 248
Received Thanks: 110
|
Quote:
Originally Posted by flo8464
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
|
#11
|
elite*gold: 0
Join Date: Nov 2009
Posts: 390
Received Thanks: 321
|
Quote:
Originally Posted by backo
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
|
#12
|
elite*gold: 0
Join Date: Nov 2008
Posts: 161
Received Thanks: 38
|
Quote:
Originally Posted by Nullable
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
|
#13
|
elite*gold: 0
Join Date: Nov 2009
Posts: 390
Received Thanks: 321
|
Quote:
Originally Posted by flo8464
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 **** many DLLImports :} and by the way, i can not find a good example of signals and slots ..
|
|
|
12/22/2009, 19:33
|
#14
|
elite*gold: 0
Join Date: Sep 2006
Posts: 248
Received Thanks: 110
|
Quote:
Originally Posted by Nullable
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 **** many DLLImports :} and by the way, i can not find a good example of signals and slots ..
|
A lightweight implementation is avaible at: with a provided example; or you can check out .. get used to being redirected to boost, must have while developing in C++.. or
|
|
|
All times are GMT +2. The time now is 01:55.
|
|