An abstract class is a class that is only meant to be inherited from. Objects cannot be created from generic classes.
To make a class abstract one of the virtual methods is made abstract by assigning it a value of zero. To make a concrete class the virtual method must be implemented in the inheriting class.
class A
{
virtual void AbstractMethod() = 0;
// The '= 0' makes the method a pure virtual
// function.
// The pure virtual function makes the class
// abstract.
};
class B: public A
{
void AbstractMethod();
};
void B::AbstactMethod()
{
}
Friday, June 08, 2007
Friday, May 18, 2007
GCC Under DOS

Are there some pre-compiled binaries that I can use?
DJGPP (DJ's GNU Programming Platform)
A complete 32-bi C/C++ development system for Intel 80386 and higher PCs running DOS. This looks very old. It has not been updated since 1998.
MinGW: Minimalist GNU for Windows
A collection of freely available and freely distributable Windows specific header files and import libraries.
Looks like a very current system.
Installed MSYS. It looks like it has the same path problems that cygwin does.
General C++ Compilers
Click the picture to go to the site.
This is a real nice little package. Fits on top of the Migw port of GCC (GNU Compiler Collection): http://www.bloodshed.net/devcpp.html
This has a whole bunch of 'free' compilers.

Perhaps the greatest single piece of software contributing to software free world.



Perhaps the greatest single piece of software contributing to software free world.
Command Line Compilers
Being really old school I like to run compiles from the command line. Especially when I am trying to learn about the language and not the IDE (Integrated Development Environment).
On a side note I find acronyms a night mare. I can forget ones I have used for years and also forget the one I just learned at the most inopportune moments. It makes me look really dumb.
I really like to run them for emacs. It just give me a sense of control at a low level.
On a side note I find acronyms a night mare. I can forget ones I have used for years and also forget the one I just learned at the most inopportune moments. It makes me look really dumb.
I really like to run them for emacs. It just give me a sense of control at a low level.
Web Sources
The web is huge on this subject. These are just some of the links I am using.
I love this site. There is no registration and tutorials and other articles are great.
http://www.cplusplus.com/

http://www.cplusplus.com/
Book Sources
These are the main books I am using for C++.
Teach Yourself C++, Second Edition by Herbert Schildt.
I really like his book. It is clear and easy to understand. However, it is also a little light on some topics and/or the index is a little week.
It look like it might be a good idea to get the third edition: http://www.geek.com/hwswrev/tyc++3.htm
Teach Yourself C, Third Edition, by Herbert Schildt.
Together with his book on C++ it is also clear and easy to understand.
C++ Primer, by Stanly B. Lippmon. Nice book, but seems a bit aged. I don't use it much.
So often I simply look it up on the web I am wondering it books will be come a thing of the past.

I really like his book. It is clear and easy to understand. However, it is also a little light on some topics and/or the index is a little week.
It look like it might be a good idea to get the third edition: http://www.geek.com/hwswrev/tyc++3.htm

Together with his book on C++ it is also clear and easy to understand.
C++ Primer, by Stanly B. Lippmon. Nice book, but seems a bit aged. I don't use it much.
So often I simply look it up on the web I am wondering it books will be come a thing of the past.
namespace
namespace - declares a block in which other identifiers may be declared. An identifier declared within a namespace becomes a "sub-identifier" linked to the surrounding namespace identifier. It creates a names scope.
This is a good web page on namespace: http://www.cplusplus.com/doc/tutorial/namespaces.html
namespace myNamespace
{
int a, b;
}
myNamespace::a
myNamespace::b
#include
using namespace std;
namespace first
{
int var = 5;
}
namespace second
{
double var = 3.1416;
}
int main()
{
cout << first::var << endl;
cout << second::var << endl;
return 0;
}
Using the 'using' keyword the namespace can be accessed.
namespace first
{
int x = 5;
}
using first::x;
using namespace first;
cout << x << endl;
both of the above using lines would make the x variable available.
This is a good web page on namespace: http://www.cplusplus.com/doc/tutorial/namespaces.html
namespace myNamespace
{
int a, b;
}
myNamespace::a
myNamespace::b
#include
using namespace std;
namespace first
{
int var = 5;
}
namespace second
{
double var = 3.1416;
}
int main()
{
cout << first::var << endl;
cout << second::var << endl;
return 0;
}
Using the 'using' keyword the namespace can be accessed.
namespace first
{
int x = 5;
}
using first::x;
using namespace first;
cout << x << endl;
both of the above using lines would make the x variable available.
Subscribe to:
Posts (Atom)