| | |
Accessing functions from base class
![]() |
•
•
Join Date: May 2004
Posts: 3
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by bdiamond
You should be able to just type in CPlayingCard::deal_hands() (if CPlayingCard is the name of your base class), and that should be all there is to it!!
The problem is that deal_hands function doesnt return anything at the moment.
Could it return an array of cards that could be used in the derrived class to set pcard1 , pcard2 etc.?
Thanks!
if there's an array for it in the base class, you should be able to access that array the same way CPlayingCard::array[1] (or whichever element you're looking for). Or you could have it return an array of cards by declaring the function return type as CCard*. Then just return the name of the array from the function as that will be a pointer to the first address, and a count of the cards, if it's possible for it to change. then you can iterate through each one as you need to up until the count returned. Hope this helps!!:mrgreen:
•
•
•
•
Originally Posted by dirs
Thanks for the reply!
The problem is that deal_hands function doesnt return anything at the moment.
Could it return an array of cards that could be used in the derrived class to set pcard1 , pcard2 etc.?
Thanks!
•
•
Join Date: May 2004
Posts: 3
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by bdiamond
if there's an array for it in the base class, you should be able to access that array the same way CPlayingCard::array[1] (or whichever element you're looking for). Or you could have it return an array of cards by declaring the function return type as CCard*. Then just return the name of the array from the function as that will be a pointer to the first address, and a count of the cards, if it's possible for it to change. then you can iterate through each one as you need to up until the count returned. Hope this helps!!:mrgreen:
C:\cardgame\playingcards.cpp(154) : error C2275: 'blackjack::card' : illegal use of this type as an expression.
Thanks for reply!
well try sending a pointer back of whatever type the array is then reference that pointer by a subscript
•
•
•
•
Originally Posted by dirs
I have tried to do like this CPlayingCard::array[1] but i get error
C:\cardgame\playingcards.cpp(154) : error C2275: 'blackjack::card' : illegal use of this type as an expression.
Thanks for reply!
![]() |
Similar Threads
- accessing base class methods in a derived class (C++)
- Question regarding base class and derived class (C++)
- Problem accessing base class member function whilst iterating through STL list (C++)
- Vector Base Class (C++)
Other Threads in the C Forum
- Previous Thread: Image Handler
- Next Thread: Possibility of mini servers
| Thread Tools | Search this Thread |
#include adobe api array arrays asterisks binarysearch calculate char cm copyanyfile copyimagefile copypdffile cprogramme creafecopyofanytypeoffileinc createcopyoffile createprocess() csyntax database directory dynamic feet fflush fgets file fork forloop frequency getlasterror givemetehcodez global graphics gtkgcurlcompiling hacking highest homework i/o inches include incrementoperators input interest kernel kilometer km linked linkedlist linux linuxsegmentationfault list locate logical_drives loopinsideloop. match matrix meter microsoft mqqueue mysql number odf open openwebfoundation owf pattern pdf performance pointer posix probleminc process program programming pyramidusingturboccodes radix read recursion recv repetition research scanf scheduling segmentationfault send sequential shape socket socketprograming socketprogramming stack standard string systemcall turboc unix user voidmain() wab win32api windows.h




ealCards() function.
