Object Orientated Programming 
Author Message
 Object Orientated Programming

        Hi everyone! I'm currently using a turbo Pascal 7.0 and was learning
a new way of programming (for me at least).  I came across the following and
an not sure how to use it. Can anyone enlighten me?

e.g.
        program XXXX;
        uses
                Umisc, Ugame; {This is a pre-defined unit so please ignore}

        type
                Ccar = object
                        velo, fuel, accel : integer;
                        procedure init;
                        function move(dist : integer) : integer;
                        procedure contact;
                end;

                CControl = object(Cgame)
                        dist, round : integer;
                        aCar : Ccar;
                        procedure instruct; virtual;
                        procedure ginit; virtual;
                end;
{ the main thing I don't understand is the "object" command, what does it do?
and also the "virtual" command}

        procedure Ccar.init;
        begin
                {blah blah blah}
        end;

------------------------------------------

        I've always used the simple "uses XXXX" command at the start and
then I just go on as usual declaring procedures and functions, and calling
out in the "begin end." Please tell me how to use the object thing. My
school's library is not too keen on turbo pascal and most are on C, C++.
Darn. I apologize if the problem is too primitive to everyone. I'm kinda new
to pascal. Thanks a million.


      \ \                                      
    ___> \              

  (____O)  \        
  (____O)   \
   (__O)_    \          



Sat, 05 Dec 1998 03:00:00 GMT  
 Object Orientated Programming


writes:

Quote:

>        Hi everyone! I'm currently using a turbo pascal 7.0 and was learning
>a new way of programming (for me at least).  I came across the following and
>an not sure how to use it. Can anyone enlighten me?

>e.g.
>        program XXXX;
>        uses
>                Umisc, Ugame; {This is a pre-defined unit so please ignore}

>        type
>                Ccar = object
>                        velo, fuel, accel : integer;
>                        procedure init;
>                        function move(dist : integer) : integer;
>                        procedure contact;
>                end;

[..etc..etc..]

Hey Martin, why don't you RTFM before posting? When you have, then written a
few programs to test the things you've read about and tried to figure them out
for yourself a got stuck; THEN post a question.

 ---------------------------------------------------------------------------
| Jason Burgon - author of Graphic Vision, TV-Like GUI for 256 Colour SVGA  |

|                         http://www.en.com/users/grendel/prog/tv_prog.html |
 ---------------------------------------------------------------------------



Mon, 07 Dec 1998 03:00:00 GMT  
 Object Orientated Programming

Quote:

> { the main thing I don't understand is the "object" command, what does it do?
> and also the "virtual" command}

"object" in Pascal is "class" in C++
"virtual" in Pascal is ... "virtual" (!) in C++

They are not commands, but reserved words defined in the language.
Only the syntax is different: where Pascal says:

type xyz=object
          ....
         end;

C++ says:

class xyz {....};

and where Pascal says:

procedure xyz; virtual;

C++ says:

virtual void xyz();

Likewise inheritance.
Where Pascal says:

type xyz=object(foo)
       ....
     end;

C++ says:

class xyz: public foo {...};

(I *think* "public" is mandatory, but I am not certain:
it's so long since I programmed in C++!)



Thu, 10 Dec 1998 03:00:00 GMT  
 Object Orientated Programming



Quote:
>> { the main thing I don't understand is the "object" command, what does it do?
>> and also the "virtual" command}

>"object" in Pascal is "class" in C++
>"virtual" in Pascal is ... "virtual" (!) in C++

>They are not commands, but reserved words defined in the language.
>Only the syntax is different: where Pascal says:

>type xyz=object
>          ....
>         end;

>C++ says:

>class xyz {....};

>and where Pascal says:

>procedure xyz; virtual;

>C++ says:

>virtual void xyz();

>Likewise inheritance.
>Where Pascal says:

>type xyz=object(foo)
>       ....
>     end;

>C++ says:

>class xyz: public foo {...};

>(I *think* "public" is mandatory, but I am not certain:
>it's so long since I programmed in C++!)

Well I've never programmed in C++, but I don't understand OOP properly
either. Can anyone explain it in plain english please?

Thanx,

Robert
#=========================================================#
# Robert 'Spooky' Fahey    | This Email is definitive,    #

#==========================|==============================#
# Soon at WWW.SYMBIOSYS.IE |     ALL DONE. BYE BYE.       #
#=========================================================#

Turnpike evaluation. For information, see http://www.turnpike.com/



Sun, 20 Dec 1998 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. What is the definition of a OBJECT ORIENTATED LANGUAGE, and what is a object?

2. Desperate help on Object-oriented programming (turbo pascal)

3. Object Pascal Programming

4. Object-programming in Turbo Pascal

5. Object Oriented Programming Tutorials

6. Object Programming .....

7. object oriented programming and its use

8. Object Oriented Programming Tutorials

9. Object oriented programming

10. Borland Pascal With Objects Programming Suite

11. Borland Pascal With Objects Programming Suite

12. Help with programming buttons in Object-Pal/Paradox 7

 

 
Powered by phpBB® Forum Software