HI, I am new in OOP. I want to know the difference between OOA,OOD & OOP. Also I want to know the diff between Extend, Abstract,Parent, Child, SuperClass and subclass(by an example if possible) Thanks in advance, angela
OOA - Object Oriented Analysis OOD - OO Design OOP - OO Programming these are diffrent stages in a s/w life cycle. In different stages, u can apply OO.
Originally posted by Angela Jessi: HI, I am new in OOP. I want to know the difference between OOA,OOD & OOP. Also I want to know the diff between Extend, Abstract,Parent, Child, SuperClass and subclass(by an example if possible) Thanks in advance, angela
Parent - The base class. Child - The child class extends the base class. The idea is to have on class extend the other. If class B extends A, B can do everything A can do, and more. So if A has 3 methods and 2 variables, so will B (the programmer only needs to say that class B extends class A, he does not need to rewrite the methods). We B class B inherits from class A. B may then add in more methods and variables. B can also change the behavior of the methods, this is known as overridding methods. Abstract classes are those which of which you can never get a real instance. The are only general ideas, and placeholders in the class hierarchy. You can't say "new MyAbstractClass()" as you could with other classes.
General example. I might have an Animal class. All Animal objects have certain properties, like weight. Animals also have a method eat(). I could then subclass the Animal class, specifically, "class Cat extends Animal". (Cat subclasses Animal; Animal is the parent of Cat; Cat is the child of Animal.) Cats can eat and have a weight. Cats also have a method called purr(). Ths is something only Cat objects can do, and not Animals. I can also create a Dog class, like a Cat class, it extends Animal. Dogs have a method bark(). Cats cannot bark(). Dogs cannot purr(). Dogs do have weight and can eat(). Unlike Cat, there is no Animal in nature. It's just a concept. I would never say, "there's an animal" wihout being able to subclass it futher (cat, elephant, etc). So I would make my animal class abstract, so the program could never create something that is only an animal class, but nothing more.
Best bet is to go to your local book store, and grab a basic Java book. Chapter 2 or 3 is always an intro to Object Oriented Programming.
Angela , it seems that you want to learn oops. there are many good books available to start with. There are many threads on the topic in this forum. Please go through them & you will find many books. Plus on net , you will find many good resources . I hope this can be useful. Your Friendly Bartender Shailesh.