|
jhwurmbach wrote: I was under the impression that the C++-Standard predates ANSI-C.
I think they are roughly nine years apart. The ANSI C standard was completed in 1989. The ANSI-ISO C++ standard was completed in 1998. The next C++ standard is expected out within the next 3 years.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: The ANSI C standard was completed in 1989. The ANSI-ISO C++ standard was completed in 1998.
Yes, you are right.
I was thinking of ANSI-C99, but before there was a ANSI-C90.
DavidCrow wrote: The next C++ standard is expected out within the next 3 years.
That is what they are telling us for years.
I would guess that C++0X will need a hexadecimal digit for X...
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
Hi guys,
havent found the answer for my question till now..discussion seems to be nice and interesting but pls answer to the question that i have asked..
thanks
|
|
|
|
|
Your question has been answered quite a few times, additionally, a lot of links have been given.
Short recapitulation:
In class es, the default visibility is private , in struct s, it is public .
Classes can be template parameters, where structs can not.
Thats all, folks.
-- modified at 8:11 Wednesday 9th August, 2006
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
toxcct wrote: C is a subset of C++...
Maybe at a high level, but not in a pure mathematical sense. It's possible to have a valid C program that is not valid C++ code. C++ can be considered a superset of C, however.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
'class' is proper OO terminology, 'struct' isn't.
but default member access isn't the only difference between struct and class: you can't use templates on structs - only on classes .
a 'class' is intended to be the primary object type. 'struct' is for backwards compatibility. and, yes they overlap .
|
|
|
|
|
Chris Losinger wrote: you can't use templates on structs - only on classes .
If you mean you can't use struct keyword inside of a template declaration, you are right. However, it is perfectly possible to make struct templates.
|
|
|
|
|
right.
template < struct T > class nope {...}; = bad
|
|
|
|
|
Default inheritance type: a struct entails public inheritance by default whereas a class entails private inheritance.
Regards
Amar
|
|
|
|
|
Subramaniam s.V. wrote:
Can anybody tell me the exact "Difference between C++ Structures and C++ Classes".
This is discussed in The Design and Evolution of C++.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
About differences. The default protection in case of class is "private ", whereas in case of struct it is "public ":
class A
{
int a;
. . .
};
struct A
{
int a;
. . .
};
The default inheritance protection in case of class is "private ", whereas in case of struct it is "public ":
class B : A
{
};
struct B : A
{
};
That’s my opinion about differences.
|
|
|
|
|
|
struct and class in C++ are identical with the exception of their default visibility (private for class, public for struct). The struct keyword was a leftover from the C lineage of C++. That said, when a C++ compiler sees the struct keyword, it will compile it, but not in the same way that a C compiler would have. The C++ compiler will generate a default constructor, destructor, and copy-assignment operator (whereas a C compiler would just treat it as a new datatype).
They both exist in C++ because of the desire to be able to compile C code with a C++ compiler. Removing keywords such as this would have made such backwards-compatability impossible without first modifying the codebase.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
I'm putting together code for a template that implements some special tasks that I need and I want it to use with different CWnd based classes as template argument and ancestor at the same time like this:
template < class BASE >
class CLASS : public BASE
{
.
.
.
};
If I want to use it with CFormView and CDialog in the same project I need template argument dependent compiling, 'cause for example if I need to implement OnInitDialog() for CDialog, I must ignore it with CFormView, otherwise I get an error that this function is not the member of the base class.
I thought of doing string comparison of the BASE argument at the right places, but I'm not too familiar with macros.
#define STR_COMP(_base, _class) \
(strcmp(#_base, _class)==0)
and use it as
#if STR_COMP(BASE, "CDialog")
.....
#else if ...
....
#else
...
#endif
Of course it doesn't work....
|
|
|
|
|
|
Maybe you should try a "specialization" of template classes? I suppose it may look like this:
template< class BASE >
class COMMON : public BASE
{
. . .
};
template< class BASE >
class CLASS : public COMMON< BASE >
{
};
template< >
class CLASS< CDialog > : public COMMON< CDialog >
{
. . .
};
template< >
class CLASS< CFormView > : public COMMON< CFormView >
{
. . .
};
Usage:
CLASS< CDialog > dlg;
CLASS< CFormView > form;
I hope this works.
|
|
|
|
|
I already figured but thanks, anyway.
Anybody dealing with the same issue should know to have all the specialized functions inline in the header file if want to get rid of LNK2006 errors..
|
|
|
|
|
Hi to all,
I am compiling DirectX 9.0 SDK Sample Code Filter in VC6, it is compiling successfully. (Filter is DSNetwork Filter)
But when same code I compile in VC++ 2005, it is showing errors (as follows),
1. fatal error C1083: Cannot open source file: 'c:\DXSDK\Samples\C++\DirectShow\Filters\Change': No such file or directory c1
2. command line error MIDL1003 : error returned by the C preprocessor (2) midl
3. error PRJ0019: A tool returned an error code from "Performing Custom Build Step" dsnetifc
4. error BK1506 : cannot open file '.\Debug_Unicode\dsnetifc_i.sbr': No such file or directory BSCMAKE
5. error C2146: syntax error : missing ';' before identifier 'PVOID64' C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h 222
6. error C4430: missing type specifier - int assumed. Note: C++ does not support default-int C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h 222
7. error C2146: syntax error : missing ';' before identifier 'Buffer' C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\include\winnt.h 5940
& many more..
plz. help me.
Thanks & Best Regards,
Aniket Salunkhe
|
|
|
|
|
Try this:
Go to Tools->Options->Project and solutions -> VC++ Directories
Show library files -> Library files
At top include
D:\DXSDK\Samples\C++\DirectShow\BaseClasses\Release(or Debug)
at last
D:\DXSDK\lib
Show library files -> Include files
At last
D:\DXSDK\Include\DShowIDL
D:\DXSDK\Include
D:\DXSDK\Samples\C++\DirectShow\BaseClasses
Regards
Amar
|
|
|
|
|
pls help me for the sln
how to find out
whether the Directory is persent or Not(C drive or D Drive)
is there any API available in C++?
|
|
|
|
|
What exactly u want. To find the Directory or Drive?
Come online at:-
fitiyal@yahoo.com
|
|
|
|
|
1)To find the Drive?
2) To Find out Directory?
|
|
|
|
|
Use FindFirstFile()
Come online at:-
fitiyal@yahoo.com
|
|
|
|
|
You can use good old _stat() or _access()
|
|
|
|
|
use
PathFileExists()
nave
|
|
|
|