Does abstraction (Oops Concept) means using Abstract class.....people are really confused about this..any help with sample code would be really appreciated
RSS
im not sure i understood your question but here my attempt to answer it,
the abstract class Person, has a abstract method SomeMethod(), wich is the "essential thing".
as you can see the complex thing (the method implementation) is hidden because the abstract method only assures that the specialized class derived from Person (wich is class Men) is oblidge to implement that method, "the complex thing".
im not sure i understood your question but here my attempt to answer it,
the abstract class Person, has a abstract method SomeMethod(), wich is the "essential thing".
as you can see the complex thing (the method implementation) is hidden because the abstract method only assures that the specialized class derived from Person (wich is class Men) is oblidge to implement that method, "the complex thing".
So you mean to say..hiding the complex thing means..keeping abstract methods in abstract class...so when ever the abstract class has abstract methods then we can say that...that abstract class showing the essential thing...that is hiding the complexity which
subclass needs to implement..
if a class has an abstract method, then the class must be abstract, and all the class tha derive the abstract class must implement the absctract method!
Surendiran
Member
21 Points
135 Posts
Does abstraction (Oops Concept) means using Abstract class.....people are really confused about t...
Jan 17, 2012 12:52 PM|LINK
Hi,
Does abstraction means implementing or using Abstract class in C#.
Ref: http://forums.asp.net/t/1258933.aspx/1
In the above forum the people are giving different views..such as
One guy says Abstraction : Abstraction means hiding the complex thing and showing essential thing(like TV or Car)
Another guy says Abstraction :Abstraction means that you have some class that is more common than others that extend it.
Which one of the above statement is true...
If the first statement is true hiding the complex thing..please give us real example with completed code..
else if the second statement is true please explain it with sample code
tehremo
Star
10540 Points
1704 Posts
Re: Does abstraction (Oops Concept) means using Abstract class.....people are really confused abo...
Jan 17, 2012 01:08 PM|LINK
"Abstraction means hiding the complex thing and showing essential thing(like TV or Car)"
That is the correct statement.
Surendiran
Member
21 Points
135 Posts
Re: Does abstraction (Oops Concept) means using Abstract class.....people are really confused abo...
Jan 17, 2012 01:18 PM|LINK
Thanks for your quick response...
Could you please explain it with some C# code..i believe its a difficult one to explain..
Surendiran
Member
21 Points
135 Posts
Re: Does abstraction (Oops Concept) means using Abstract class.....people are really confused abo...
Jan 17, 2012 01:27 PM|LINK
Thanks for your quick response...
Could you please explain it with some C# code..i believe its a difficult one to explain..
ze.espogeira
Member
383 Points
101 Posts
Re: Does abstraction (Oops Concept) means using Abstract class.....people are really confused abo...
Jan 17, 2012 01:29 PM|LINK
example:
public abstract class Person
{
protected abstract string SomeMethod();
}
public class Men : Person
{
protected override string SomeMethod()
{
// implement the abstrat method here in the derivative class!
}
}
hope it helps!
Surendiran
Member
21 Points
135 Posts
Re: Does abstraction (Oops Concept) means using Abstract class.....people are really confused abo...
Jan 17, 2012 01:46 PM|LINK
The above example clearly says generalization...ie ..Abstraction means that you have some class that is more common than others that extend it
I dont find anywhere in the code for the def: Abstraction means hiding the complex thing and showing essential thing(like TV or Car)"
where is data hiding that is hiding the complex thing in the above code
ze.espogeira
Member
383 Points
101 Posts
Re: Does abstraction (Oops Concept) means using Abstract class.....people are really confused abo...
Jan 17, 2012 02:30 PM|LINK
im not sure i understood your question but here my attempt to answer it,
the abstract class Person, has a abstract method SomeMethod(), wich is the "essential thing".
as you can see the complex thing (the method implementation) is hidden because the abstract method only assures that the specialized class derived from Person (wich is class Men) is oblidge to implement that method, "the complex thing".
Surendiran
Member
21 Points
135 Posts
Re: Does abstraction (Oops Concept) means using Abstract class.....people are really confused abo...
Jan 17, 2012 03:20 PM|LINK
So you mean to say..hiding the complex thing means..keeping abstract methods in abstract class...so when ever the abstract class has abstract methods then we can say that...that abstract class showing the essential thing...that is hiding the complexity which subclass needs to implement..
ze.espogeira
Member
383 Points
101 Posts
Re: Does abstraction (Oops Concept) means using Abstract class.....people are really confused abo...
Jan 17, 2012 04:13 PM|LINK
yes, thats it!
if a class has an abstract method, then the class must be abstract, and all the class tha derive the abstract class must implement the absctract method!