|
Exact but it doesn't correspond to your error (because it was the other way: it worked if you add this '=0' and not if you retrieve it).
|
|
|
|
|
First, it is always usefull to add the exact error message when you got one. We cannot guess what the error message is (and in general they are really helpfull).
Now, to answer your question, the =0 means that this is a pure virtual function, that is a function that NEED to be redefined in the child classes. If you don't redefine them in child classes and if you try to instantiate your object, you will get an erro telling you that it cannot instantiate the class due to pure vitual function.
But in your example, I don't see why you get an unresolved external error if you don't add this =0. Maybe try to post more code and the exact error message.
|
|
|
|
|
lastgen wrote: What does the "= 0" indicate?
This means FOO is a pure virtual function, implementation for which will be provided in a derived class of the class ABC .
ABC cannot be instantiated directly. But derived classes for ABC which provide an implementation for FOO can be instantiated.
Nibu thomas
Software Developer
|
|
|
|
|
I am making an assumption that you did not define the function in the original class and that the second version worked. If you had defined the function (or method) in the first class you would not have had an error. Your could have simply declared it as this virtual void FOO (BAR& foo) {}; and there would not have been an error, you would have just had a function that did not do anything.
The second version declares a pure virtual function, which needs to be implemented by a derived class. That is you inherited the interface from the defined base class (ABC) and must provide a function for the inherited interface. What that means is in the base class you have said this function must exit in the derived class, because it does not actually exist in the base class.
Let’s try this,
If you declare a function in a class the compiler will complain if that function does not exist. Therefore you must define the function so any one using that class will have that function to call. If you make the function as a pure virtual function, then the class is designed as a base interface class that is not intended to be used by its self, but is intended to be used as a base for derived classes.
I know I sound like some text book, but I have been doing this a long time. Look up the words “pure virtual” and “virtual base class” along with “C++” on the Web; you should come up with a few decryptions. Amongst those may be instrument and car, all cars have things in common like press the accelerator, press the brake, and ect… . The base class specifies all things that classes derived from it have in common and forces all derived classes to implement those behaviors.
Think of the “= 0” as a requirement that you impose on all users of the class that you have defined.
I hope that helps,
John R. Shaw
INTP
Every thing is relative...
|
|
|
|
|
What is the difference between unions and structures .
Yaaqub
|
|
|
|
|
A union is essentially a structure in which all of the fields overlay each other; you can only use one field at a time. But that's not the case with structures. In structures fields don't overlay each other and any field can be used any time.
The size of a union is the maximum of the sizes of its individual members, while the size of a structure is the sum of the sizes of its members.
Nibu thomas
Software Developer
|
|
|
|
|
Each field of a union starts at the same location in memory, whereas each field in a structure gets separate memory locations.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Just to explain so that you can get a clear view of what the difference is:
suppose we have a structure
struct abc
{
int a;
char b;
}a1;
When you try to use the sizeof operator on this, the value will be correctly printed as int of size 2bytes and a char value of 1 byte .
The total size of the structure would thus be 3
On the other hand if you use unions and declare it as
union def{
int a;
char ch;
}u1;
Then the size of operator will show 2. As the memory of variables in a union is shared and the size is of the highest occupant in the union.
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
|
|
|
|
|
AnShUmAn_VCPP wrote: When you try to use the sizeof operator on this, the value will be correctly printed as int of size 2bytes...
I think you mean 4 bytes.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
yes . The value that will be shown is compiler dependent.
If you work on turbo c you will get 2
if you work on visula studio you will get the size of an int in this case
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
|
|
|
|
|
AnShUmAn_VCPP wrote: If you work on turbo c you will get 2
But this is a Visual C++ forum...
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hi, i am developing a project to take backup of a partition of a disk. I want to
know how to take incremental(backup of only those sectors which are changed after the first backup). Please help.
Thanks.
|
|
|
|
|
I'm not aware of any such markings on the sector level. Files and folders have an archive bit that gets set when the file has been changed, and most good backup programs will turn this bit off after it has successfully archived the file.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
How I copy a file from my local machine to a webserver. How can i create a new folder in the web server on a particular Virtual directory? Please share code to copy/write file in web directory using a URL as destination folder?
the target location to copy file is like "http://www.abc.com/DestFolder/" n Some cases i need to create new folder in the DestFolder also..
Please help
|
|
|
|
|
try with ISAPI concepts by getting Web server extensions.
pls. go thru
http://www.codeproject.com/ISAPI
Rgds
Vivek Subramanian
viveks
|
|
|
|
|
anilFirst wrote:
How I copy a file from my local machine to a webserver.
You can use HTTP or FTP for this. The Web server has to be configured to accept files, however.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
How to hide standard toolbar in my simple appliation by default?
When I run my application it is showing the standard toolbar and status bar. at first time I like to hide these 2. After my selection in menu then only these toolbars should be appear. how to make it. Thanks.
Nice talking to you.
If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
Just remove the WS_VISIBLE style during creation of the toolbar inside the OnCreate function.
Nibu thomas
Software Developer
|
|
|
|
|
Ya. Working. Thanks.
Nice talking to you.
If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
Hi,
Use ShowControlBar()
Bye,
Cool Ju
Dream Ur Destiny
|
|
|
|
|
I declare a Command like this :
CCommand<caccessor
<cdboarticle1accessor> >tabmiki; and I open it like this :
hr = tabmiki.Open(session, "SELECT * FROM article1 ", NULL);
And in my form I put to buttons(NEXT, and Previous) in side I write tabmiki.movenext() and tabmiki.moveprev().
movenext() works but moveprev() don't works, I don't know why
Can you help me ?
I learn my self
-- modified at 0:59 Wednesday 1st March, 2006
|
|
|
|
|
What is CdboARTICLE1Accessor ?
mikobi wrote: Can you help me ?
Probably not, since you failed to provide anything useful. You need to set a breakpoint in the moveprev() method and then single-step through it until you find the statement(s) that does not work. Otherwise, it could be any number of things, and you'll end up "chasing a rabbit" as a result.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I am using SQL SERVER 2000 as database;
CdboARTICLE1ACcesor is an Class Accesor i generate from ARTICLE1 table.
|
|
|
|
|
I dont know how to connect with SQL server 2000 and retrive the data?
i belive that u can help me.
thanks in advance
JAYARAJ
|
|
|
|
|
To retrieve data from SQL SERVER, make first an Accessor.Do that in your project workspace:
Click on Insert -> New ATL Object; in catégories choice Data Access->Consumer from here enter the name of your database; password;choice command and click on ok after choice the table you want to access, click in ok again.
Here a Class Accessor is generate.
Now in your event write this code :
bool bsavevalidation = true;
CWnd::UpdateData(bsavevalidation);
HRESULT hr;
CDataSource db;
CDBPropSet dbinit(DBPROPSET_DBINIT);
CString strItem;
int k = 0;
CSession session;
CString strCommand,strSql;
dbinit.AddProperty(DBPROP_AUTH_PASSWORD, OLESTR("yhwha"));
dbinit.AddProperty(DBPROP_AUTH_PERSIST_SENSITIVE_AUTHINFO, false);
dbinit.AddProperty(DBPROP_AUTH_USERID, OLESTR("sa"));
dbinit.AddProperty(DBPROP_INIT_CATALOG, OLESTR("STOCK"));
dbinit.AddProperty(DBPROP_INIT_DATASOURCE, databas);
dbinit.AddProperty(DBPROP_INIT_LCID, (long)1036);
dbinit.AddProperty(DBPROP_INIT_PROMPT, (short)4);
hr = db.Open(_T("SQLOLEDB.1"), &dbinit);
if (FAILED(hr))
{
AfxMessageBox("impossible d'ouvrir la baseo");
}
else
{
hr = session.Open(db);
if (FAILED(hr))
{
AfxMessageBox("session non Ouverte");
}
else
{
CDBPropSet propset(DBPROPSET_ROWSET);
propset.AddProperty(DBPROP_CANFETCHBACKWARDS, true);
propset.AddProperty(DBPROP_IRowsetScroll, true);
propset.AddProperty(DBPROP_IRowsetChange, true);
propset.AddProperty(DBPROP_UPDATABILITY, DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_INSERT | DBPROPVAL_UP_DELETE );
bool bsavevalidation = true;
CWnd::UpdateData(bsavevalidation);
CCommand<caccessor<cdbotabcmdeaccessor> >cmde ;
CCommand<caccessor<cdborequisitionaccessor> >req ;
CCommand<caccessor<cdbodemprixaccessor> >dem ;
CCommand<caccessor<cdbodetcmde2accessor> >det ;
CCommand<caccessor<cdbodetlivaccessor> >liv ;
CString str1,str2,str3,str4,str5,str6,str7,str8,str9,str0 = "";
int i = 0;
strCommand = "select * from detcmde where numreq = '%s'";
strSql.Format(strCommand,m_numcmde);
hr = det.Open(session, strSql,NULL);
if (det.MoveFirst() != S_OK)
{
|
|
|
|