abstract classes
-
An abstract class is a special kind of class that cannot be instantiated.No funciton definition can be done in these type of classes. So what's the advantaghe to incorporate these kind of classes in our project?
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
-
An abstract class is a special kind of class that cannot be instantiated.No funciton definition can be done in these type of classes. So what's the advantaghe to incorporate these kind of classes in our project?
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
As a base class.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
An abstract class is a special kind of class that cannot be instantiated.No funciton definition can be done in these type of classes. So what's the advantaghe to incorporate these kind of classes in our project?
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
Pankaj Garg wrote:
No funciton definition can be done in these type of classes.
What do you mean? It's quite possible to have methods and properties in the abstract class. The only limitation is that it cannot be instantiated. As previously stated you use them as base classes that can contain common functionality that all derived classes need/can make use of.
-
As a base class.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
This is further to ur reply. If i say , what's the need of such a base class , which doesnot have funciton definition , only contains funciton declaration. I can also create such class , where i am defining the funcitons , further , i can override the base class functions , if needed. Sir , Isn't that ?
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
-
This is further to ur reply. If i say , what's the need of such a base class , which doesnot have funciton definition , only contains funciton declaration. I can also create such class , where i am defining the funcitons , further , i can override the base class functions , if needed. Sir , Isn't that ?
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
For example, I wrote a paint program. All my paint tools derived from a Tool class. Tool is not useful, it merely defines the base. So, I don't want to be able to create Tool, only it's derived classes.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
An abstract class is a special kind of class that cannot be instantiated.No funciton definition can be done in these type of classes. So what's the advantaghe to incorporate these kind of classes in our project?
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
-
An abstract class is a special kind of class that cannot be instantiated.No funciton definition can be done in these type of classes. So what's the advantaghe to incorporate these kind of classes in our project?
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
The abstract keyword is for classes which forms the base for other classes, but does not implement full functionality by itself. You can look at it as a safety net of sorts.
-- Kein Mitleid Für Die Mehrheit
-
An abstract class is a special kind of class that cannot be instantiated.No funciton definition can be done in these type of classes. So what's the advantaghe to incorporate these kind of classes in our project?
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
Pankaj Garg wrote:
An abstract class is a special kind of class that cannot be instantiated.
Correct.
Pankaj Garg wrote:
No funciton definition can be done in these type of classes.
That is not correct.
Despite everything, the person most likely to be fooling you next is yourself.
-
An abstract class is a special kind of class that cannot be instantiated.No funciton definition can be done in these type of classes. So what's the advantaghe to incorporate these kind of classes in our project?
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
:)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke -
The abstract keyword is for classes which forms the base for other classes, but does not implement full functionality by itself. You can look at it as a safety net of sorts.
-- Kein Mitleid Für Die Mehrheit
Jörgen Sigvardsson wrote:
but does not implement full functionality by itself
They usually don't, but they may.
-
An abstract class is a special kind of class that cannot be instantiated.No funciton definition can be done in these type of classes. So what's the advantaghe to incorporate these kind of classes in our project?
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
Pankaj Garg wrote:
you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
But if you (for instance, don't take it personally) have a bad idea and tell me about it, and I give you back a better idea, we both end up with one idea. (Both instances of the bad idea get garbage collected.)
-
An abstract class is a special kind of class that cannot be instantiated.No funciton definition can be done in these type of classes. So what's the advantaghe to incorporate these kind of classes in our project?
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
Yes,thats right you can make a class that its fundamental for other classes but you cant declare variable at this class you can use of it as parent class.