Click here to Skip to main content
15,929,796 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Stupid newbies need help. Pin
u6ik15-Aug-05 0:03
u6ik15-Aug-05 0:03 
GeneralRe: Stupid newbies need help. Pin
HumanOsc15-Aug-05 0:10
HumanOsc15-Aug-05 0:10 
GeneralC++ and Python Questions... Pin
Raistlfiren14-Aug-05 18:46
Raistlfiren14-Aug-05 18:46 
GeneralRe: C++ and Python Questions... Pin
code-frog14-Aug-05 19:00
professionalcode-frog14-Aug-05 19:00 
GeneralRe: C++ and Python Questions... Pin
Raistlfiren14-Aug-05 19:16
Raistlfiren14-Aug-05 19:16 
GeneralRe: C++ and Python Questions... Pin
code-frog14-Aug-05 19:35
professionalcode-frog14-Aug-05 19:35 
GeneralRe: C++ and Python Questions... Pin
Raistlfiren14-Aug-05 19:55
Raistlfiren14-Aug-05 19:55 
GeneralRe: C++ and Python Questions... Pin
code-frog14-Aug-05 21:26
professionalcode-frog14-Aug-05 21:26 
You are kind of talking about several things. You don't by chance have a book by Herbert Schildt called The C/C++ Complete Reference do you? http://www.amazon.com/exec/obidos/tg/detail/-/0072226803/002-4765200-8896040?v=glance[^]

This book gives perhaps the most comprehensive view of the C/C++ language I've ever come across. It's a big read but if you go all the way through it you will get good foundations in C and C++ and he covers Inheritance, Polymorphism and Encapsulation really well. He also takes you through good examples of each. The book is in it's 4th edition and is one of the most recognized books on C++ out there. It's a great book especially for beginners. I highly recommend it.

What you have described above is not quite correct. The programming model you describe Define, Test, Method doesn't exist. It sounds kind of scary. Every object you code will do what you describe above except for testing that's your job.

Read this for a basic idea of how squares, triangles and circles would relate to shapes http://cplus.about.com/od/beginnerctutorial/l/aa120502a.htm[^]

Think of it more like:

A werewolf "is a" wolf, a wolf "is a" canine a canine "mammal" a mammal "is a" animal an animal "is a" kingdom.

So a werewolf can do everything that a wolf does but a bit more. A wolf does everything a canine does but it does not beg like a dog nor does it kill Londoners like a werewolf. A canine is a mammal in that it breathes air, gives birth to live young, so does a wolf, so does a werewolf. A mammal does not live in water. An animal eats, sleeps, multiplies and is part of a kingdom an animal only eats, sleeps and multiplies. It does not give birth to live young because not all animals do.

As you move up the chain of inheritance from Kingdom to Werewolf each subsequent "is a" gets everything from it's base and can add to it. So werewolf gets everything that a wolf gets from canine and canine gets from mammal etc... You can implement kill() in canine because canine's kill to eat, so do wolfs and so do werewolfs. You cannot implement mutate() in canine because only werewolves mutate. Does this make sense?

Objects should be well defined objects that inherit base functionallity from other objects. Car would inherit everything in vehicle. Car.Drive() Car.Stop() Car.Go() if F1RaceCar inherits car it automatically can .Drive, .Stop and .Go without writing a line of code. F1RaceCar gets all that from Car. However F1RaceCar can add F1.Sponsor() F1.PitStop F1.PitCrewMember() but car does not need these thing and neither does vehicle.

You compose base functionallity and extend that functionallity using well define objects that build logically on top of their base. So what you get is.

#include canine

class werewolf()

You don't need to include "mammal" or "animal" because canine gives all of those to werewolf by design.

This is about as far as I'm willing to go in this because guys like Schildt do a better job. Get the book and read it 1 page at a time. Trust me, you really need to. Either that or get the book that Christian recommended. Just pick one. Go all the way through it several times. Don't jump from one book to the next. Pick one and stick it out. You'll be glad you did.


My name is Maximus Decimus Meridius, commander of the Armies of the North, General of the Felix Legions, loyal servant to the true emperor, Marcus Aurelius. Father to a murdered son, husband to a murdered wife. And I will finish this project, in this life or the next. Slightly modified " from Gladiator.

Code-frog System Architects, Inc.

GeneralRe: C++ and Python Questions... Pin
Raistlfiren15-Aug-05 10:46
Raistlfiren15-Aug-05 10:46 
GeneralRe: C++ and Python Questions... Pin
code-frog14-Aug-05 19:52
professionalcode-frog14-Aug-05 19:52 
GeneralRe: C++ and Python Questions... Pin
S. Senthil Kumar14-Aug-05 19:12
S. Senthil Kumar14-Aug-05 19:12 
GeneralRe: C++ and Python Questions... Pin
Raistlfiren14-Aug-05 19:24
Raistlfiren14-Aug-05 19:24 
GeneralRe: C++ and Python Questions... Pin
Christian Graus14-Aug-05 19:35
protectorChristian Graus14-Aug-05 19:35 
GeneralRe: C++ and Python Questions... Pin
Christian Graus14-Aug-05 19:43
protectorChristian Graus14-Aug-05 19:43 
GeneralRe: C++ and Python Questions... Pin
Raistlfiren14-Aug-05 20:28
Raistlfiren14-Aug-05 20:28 
GeneralRe: C++ and Python Questions... Pin
Kevin McFarlane15-Aug-05 0:00
Kevin McFarlane15-Aug-05 0:00 
GeneralRe: C++ and Python Questions... Pin
markkuk15-Aug-05 1:52
markkuk15-Aug-05 1:52 
GeneralRe: C++ and Python Questions... Pin
Raistlfiren15-Aug-05 10:37
Raistlfiren15-Aug-05 10:37 
GeneralRe: C++ and Python Questions... Pin
Christian Graus15-Aug-05 13:12
protectorChristian Graus15-Aug-05 13:12 
GeneralRe: C++ and Python Questions... Pin
Raistlfiren15-Aug-05 16:11
Raistlfiren15-Aug-05 16:11 
GeneralRe: C++ and Python Questions... Pin
Christian Graus15-Aug-05 16:15
protectorChristian Graus15-Aug-05 16:15 
GeneralRe: C++ and Python Questions... Pin
vincent.reynolds15-Aug-05 7:03
vincent.reynolds15-Aug-05 7:03 
GeneralRe: C++ and Python Questions... Pin
Raistlfiren15-Aug-05 10:42
Raistlfiren15-Aug-05 10:42 
GeneralRe: C++ and Python Questions... Pin
DavidNohejl15-Aug-05 15:11
DavidNohejl15-Aug-05 15:11 
GeneralRe: C++ and Python Questions... Pin
Raistlfiren15-Aug-05 16:04
Raistlfiren15-Aug-05 16:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.