MajorGeeks Support Forums

Go Back   MajorGeeks Support Forums > ----------= PC, Desktop and Laptop Support =---------- > Software
Register FAQ Members List Calendar Casino Mark Forums Read

Software Software such as operating systems like Windows XP, Windows Vista, Windows 7 etc., or specific programs.


Reply
 
Thread Tools Display Modes
  #1  
Old 03-18-07, 20:53
Tomdude22388 Tomdude22388 is offline
Private E-2
 
Join Date: Jan 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Encapsulation, Inheritance and Polymorphism????

Hello. I am starting to learn C++. I am a new programmer and dont know much. Can any one explain to me in the simplest way what is Encapsulation, Inheritance and Polymorphism?
Reply With Quote
Sponsored links
  #2  
Old 03-19-07, 09:39
ShockTroop's Avatar
ShockTroop ShockTroop is offline
Specialist
 
Join Date: Mar 2006
Location: eastern New Hampshire
Posts: 373
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: Encapsulation, Inheritance and Polymorphism????

Encapsulation is basically hiding code, mostly through the use of classes and private variables in object-oriented programming. This is so the outside can't directly access certain things.

Inheritance is when one class is derived from another. If Class B inherits from Class A, Class B has everything in Class A plus anything else the programmer adds.

Polymorphism is when one class inherits from another, but performs some methods differently. If Class B inherits from Class A, Class A might have a math() method that adds two numbers, while Class B might use the inherited math() method to multiply two numbers. They have the same name but do two different things. I think there's another aspect having to do with pointers to base classes, but I won't get into that.

There are a couple pages on http://www.cplusplus.com that might explain these things better as well as give more examples.
Reply With Quote
  #3  
Old 03-19-07, 10:49
jarcher's Avatar
jarcher jarcher is offline
I can't handle a title
 
Join Date: Jun 2004
Location: in morbid fear
Posts: 3,758
Thanks: 0
Thanked 2 Times in 2 Posts
Default Re: Encapsulation, Inheritance and Polymorphism????

I myself was reading about Encapsulation, Inheritance and Polymorphism today. .


Encapsulation:
basicly hiding details of how a piece of software was written and only telling what is needed to understand the use of a class or oblect

example:
if you put your foot on the accelerator, the car goes.

you dont need to know how it works( the cycle of air and gasoline, ignighting the mixture), thoes details aren't needed to drive a car.


Polymorphism:
one methond name, used as an instruction, can cause differnt actions depending on what kind of object performs the action

the best example I can come up with is:

you can have the English instruction "go play your favorite video game".
that could mean differant things to diffrant people

there can be a method [output] that will output the data of an object. But what data and how much data it outputs depends on what kind of object carries out the action,

Inheritance:
is a way of organizing classes with properties in common that can be grouped together.

like humans and apes are mammals. .but so are whales

I hope that helps. .my spelling is awful I know. .but it is jus something that wea ll have to deal with. . . .
Reply With Quote
  #4  
Old 03-19-07, 17:59
Tomdude22388 Tomdude22388 is offline
Private E-2
 
Join Date: Jan 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re: Encapsulation, Inheritance and Polymorphism????

Thanks both of you. Everything is so clearer now. Thank you very much
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 16:46.

MajorGeeks.Com Menu

MajorGeeks.Com \ All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ NEW! PC Games \ System Tools \ Macintosh \ Demonews.Com \ Top Downloads

MajorGeeks.Com \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds


Powered by vBulletin® Version 3.8.4
Copyright © 2009 vBulletin Solutions, Inc. All rights reserved.
Ad Management by RedTyger