TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: David Nugent
from: Frank Adam
date: 1996-11-23 12:02:00
subject: inheritence and structs

G'Day David,
 
-=> Quoting David Nugent to Frank Adam <=-

 >  FA> Yeah,but those derived structures are driving me bananas.;-) 
 > C'mon, you were supposed to laugh at this, there are no derived
 > structures.:-)
Ok, who's using my name ? ;-)

 > Although in C++ a struct is treated as a class methink.

 DN> You've got it backwards.
What i meant was that structs can have member functions in C++.

 DN> implement the OO paradigm. In fact, there is a syntactic 
 DN> difference between the two - members of a struct are, by 
 DN> default, publicly visible.
Ah, didn't know that.

 DN> In other words, a C++ class is a C struct on steroids. :-)
Yep, lucky C++ becoming an olympic sport is not very likely.. :-)  

What's worse though is this little test i did..

#include  /* i hate cout */

struct base
{
 int fred()
 {
  return 5;
  }
 };


struct derv : public base
{
 int fredderv(int y)
 {
  if (y == 0) return fred();
  return 1;
  }

 };

int main( void )
{
 derv c;
 printf("%d %d",c.fredderv(1),c.fredderv(0));
return 0;
}

It darn well compiles and runs correct with not even a warning.  
Michael will flame the base members out of me for misleading him, 
lucky he doesn't read down this far. ;-)

  L8r Frank (fadam{at}ozemail.com.au).
  
___ Blue Wave/DOS v2.21

---
* Origin: Melbourne PC User Group BBS (3:632/309)
SEEN-BY: 3/103 50/99 620/243 623/630 632/50 107 108 271 309 348 360 371 504
SEEN-BY: 632/525 530 533 535 562 601 635/503 544 728 639/252 711/409 410 413
SEEN-BY: 711/430 808 809 932 934 712/515 713/317 714/906 800/1
@PATH: 632/309 107 360 50/99 711/808 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.