TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Steven Pasztor
from: Frank Adam
date: 1996-05-02 21:46:00
subject: Objects

G'Day Steven,
 
-=> Quoting Steven Pasztor to All <=-

 SP> Basic object use in BC++...

 SP> I've read the Borland C++ language guide, but it's a 
 SP> terrible thing to read... Anyone got a simple way of 
Borland has the worst online manual i've ever seen.My BIOS gives me more 
help:)

 SP> explaining the usage of objects in BC++?
Can you be a bit more specific then " how do i use an object ? "
Like asking how to use a house, do you want to get in, out, take a shower,
or goto the loo ? Um, disregard that "goto" :)


class foo 
{
 private:
   int boo;  /* boo can only be accessed by the meber functions */
   int somefunc(){return (boo+duh); } 
  
 public :
   int duh;  /* duh can be accessed externally */
 
   foo(){boo = 2;}   /* constructor1 */
   foo(int d){ boo= duh = d; } /* constructor2 which takes 1 argument */
   
   int GimMeboo(){ return boo; } /* dosomething */
   int GimMeboo_plus_duh(){ return somefunc();}      
   
};

main()
{
 int val;
 foo MyFoo; /* create an uninitialized instance using constructor 1 */
 foo MyOtherFoo(2); /* another initialized instance with constructor2 */

 val = MyFoo.boo; /* error, boo is private, can not be accessed . */
 val = MyFoo.duh; /* ok, but duh is nothing in this instance */  
 val = MyOtherFoo.duh /* Yep, duh = 2 in this one */
 val = MyFoo.gimMeboo(); /* ok, returns boo which is 2 */
 val = MyFoo.somefunc(); /* Error, function is private */ 
 val = MyOtherFoo.GimMeboo_plus_duh(); /* ok returns 4 */ 
 }

Well, there is a bit more to classes than this really :-)                    
    
 SP> Is the implementation consistant with other C[++] compilers?
Consistency ? :-)
Actually in C++ as far as i know it pretty much is.  

 SP> And for a rather BIG question:  Anyone got source code 
 SP> that will tear out the individual elements of a piece of 
 SP> BC++ source code? ie. turn the statements:

 SP> #include 
 SP> void main() {
 SP> int Num=42;
 SP> cout << "Greetings" << Num << endl;
 SP> }

 SP> into a series of "things" something like:

 SP> # include  void main ( ) { int num = 42 ; 
 SP> cout << "Greetings" << Num << endl ; }

Hhuh ? What is this supposed to do ?  
Do you want to put all lines within a function or braces on the same line 
or  something ? 
There is no sense (to me) having the above.....????
Or did the mssg formatting gone bonkers on my end ?


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

--- Maximus 3.01
* Origin: The Software Parlour (3:635/544)
SEEN-BY: 50/99 78/0 620/243 623/630 632/349 635/503 544 727 711/401 409 410
SEEN-BY: 711/413 430 808 809 932 934 712/515 713/888 714/906 800/1 7877/2809
@PATH: 635/544 50/99 711/808 809 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™.