Saturday, July 30, 2011

Re: (PT) IS there any use of empty class

 

i think we can't tell empty class as abstract class because of some many reasons - one reason is -> we can create an instance of an empty class, but not from abstract class. secondly - empty class does not force the derived class to implement any specific method, but in case of abstract, it forced the derived class to have its own implementation. 
As per my understanding, empty class is a class which is of no use. If my derived class is an empty class (which is derived from a base class having common functionality), then it will be useful. 
Please correct me if I am wrong and add your opinion . regards - Ravi 

--- On Fri, 29/7/11, PJH <pauljherring@gmail.com> wrote:

From: PJH <pauljherring@gmail.com>
Subject: Re: (PT) IS there any use of empty class
To: Programmers-Town@yahoogroups.com
Date: Friday, 29 July, 2011, 1:28 PM

 

On Fri, Jul 29, 2011 at 8:54 AM, Ravi Shankar <blr_ravi2006@yahoo.co.in> wrote:

> I am talking about empty class

> like this

>

> class foo{

> };

>

> Does it mean something ?

> Does it use somewhere ?

In, and of itself, no.

As presented, if unused, it's likely to be optimised away.

If it is used (as say the base class for other classes,) without

adding any actual code, it essentially becomes the equivalent of an

abstract base class.

--

PJH

[Non-text portions of this message have been removed]

__._,_.___
Recent Activity:
To unsubscribe : programmers-town-unsubscribe@yahoogroups.com

.

__,_._,___

No comments: