TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Yasmine Amin
NA
20
0
Advantages of abstraction
Jul 30 2008 6:41 AM
Hello
I have a question about abstraction. I just finished reading OOPS Concepts and .NET Part 2: Inheritance, Abstraction, & Polymorphism which was a really good article and very helpful start to OOP capabilities but I still don’t understand the advantages of abstraction.
For example, say I have a parent class called A with an abstract method getInfo(). Say the Class A has 2 child classes called B and C. Both B and C have an overridden method called GetInfo().// code in blue
The code in orange doesnt have abstraction, just 2 classes B and C inheiting a property form parent class A. so my question is why the code in blue better than the code in orange, in other words what is the advantages of abstraction.
Class A
_property1;
getInfo() //abstract method
Class B Class C
getInfo() //override method getInfo() //override method
Class A
_property1;
Class B Class C
GetB() //just another function which has the same code as ClassB.getInfo() GetC() //just another function which has the same code as ClassC.getInfo()
Thanks in adavance and i hope that my question makes sense
Reply
Answers (
8
)
using constructors
Enerweb Test