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
Getting GCC to compile under DOS is not simple.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.
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.
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/
I love this site. There is no registration and tutorials and other articles are great.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.
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.
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.
Monday, June 26, 2006
MFC List Box
Inserting a list element at the end and wanted the list to show the item just put in. But it would not in its default behavior.
I could not find how to do this searching on the net. Had to dig through existing code. Even than what I tried did not work. The problem was with using LPSTR_TEXTCALLBACK and than trying to calling the EnsureVisible function. These things are mutually exclusive.
I had to send a message so that the function was called after the text callback functions had finished what they were doing.
I could not find how to do this searching on the net. Had to dig through existing code. Even than what I tried did not work. The problem was with using LPSTR_TEXTCALLBACK and than trying to calling the EnsureVisible function. These things are mutually exclusive.
I had to send a message so that the function was called after the text callback functions had finished what they were doing.
Tuesday, June 20, 2006
Solution To Problem
The cpp related code must be in the same location as the .h code so that the including application can see everything it needs to see. Makes sense.
Nasty Linker Error
Ok, everything compiles but when I go to use I get this linker error
------ Build started: Project: MLVDialogs, Configuration: Debug Win32 ------
Compiling...
MLVDlg.cpp
Linking...
Creating library Debug/MLVDialogs.lib and object Debug/MLVDialogs.exp
MLVDlg.obj : error LNK2019: unresolved external symbol "public: __thiscall ClFIFO::ClFIFO(void)" (??0?$ClFIFO@USuProtoMsg@@@@QAE@XZ) referenced in function "public: __thiscall ClMLVDlg::ClMLVDlg(class ClMLVDlg * &,class CWnd *)" (??0ClMLVDlg@@QAE@AAPAV0@PAVCWnd@@@Z)
MLVDlg.obj : error LNK2019: unresolved external symbol "public: __thiscall ClFIFO::~ClFIFO(void)" (??1?$ClFIFO@USuProtoMsg@@@@QAE@XZ) referenced in function "public: virtual __thiscall ClMLVDlg::~ClMLVDlg(void)" (??1ClMLVDlg@@UAE@XZ)
Debug/MLVDialogs.dll : fatal error LNK1120: 2 unresolved externals
Build log was saved at "file://h:\Sandbox\Elsys\Products\Common_Software\CSCIs\MLVDialogs\Software\Debug\BuildLog.htm"
MLVDialogs - 3 error(s), 0 warning(s)
---------------------- Done ----------------------
Build: 0 succeeded, 1 failed, 0 skipped
------ Build started: Project: MLVDialogs, Configuration: Debug Win32 ------
Compiling...
MLVDlg.cpp
Linking...
Creating library Debug/MLVDialogs.lib and object Debug/MLVDialogs.exp
MLVDlg.obj : error LNK2019: unresolved external symbol "public: __thiscall ClFIFO
MLVDlg.obj : error LNK2019: unresolved external symbol "public: __thiscall ClFIFO
Debug/MLVDialogs.dll : fatal error LNK1120: 2 unresolved externals
Build log was saved at "file://h:\Sandbox\Elsys\Products\Common_Software\CSCIs\MLVDialogs\Software\Debug\BuildLog.htm"
MLVDialogs - 3 error(s), 0 warning(s)
---------------------- Done ----------------------
Build: 0 succeeded, 1 failed, 0 skipped
Class Template
This is much easier than I thought.
template \ class class-name
{
// class Ttype can be anything
// class-name will be template class created
}
But the function definition is ugly.
template \ void className\::functionName(data_t ob)
{
}
template \
{
// class Ttype can be anything
// class-name will be template class created
}
But the function definition is ugly.
template \
{
}
Meta Functions
The following talks about 'Meta Functions'.
boost-consulting.com/mplbook/metafunctions.html
This is describe as "a long last delivering practical metaprogramming tools and techniques into the hands of the everyday programmer".
Templates and Generics
Found this here: www.comeaucomputing.com
This is not really too good.
temples are used to create 'generic' things like function or class.
generic function
template ret-type func-name(parameter list)
{
// body of function
}
generic class
template class class-name
{
}
This is not really too good.
temples are used to create 'generic' things like function or class.
generic function
template
{
// body of function
}
generic class
template
{
}
Unions
I found this site look for information on unions under C++.
www.cplusplus.com
And this is some sample code for a union from the site.
union union_name
{
member_type1 member_name1;
member_type2 member_name2;
member_type3 member_name3;
.
.
} object_names;
Learning About C++
This is a blog about learning C++. I am trying to capture what I learn and what resources I use in learning.
Subscribe to:
Posts (Atom)
