Hi Vikas,

Abstarct class can have private data members and private methods.

But you can neither declare a private abstarct data member nor a private
abstract method(Since abstarct classes can't be instantiated directly it
makes sense)

Eg.

public  abstract class AbsBaseClass
    {
        private int privateData;

        public AbsBaseClass()
        {
            this.privateData = 10;
        }
     

        public int PrivateData
        {
            get
            {
                return this.privateData;
            }
            set
            {
                this.privateData = value;
            }
        }

        private void PrivateMethod()
        {
            this.privateData = 0;
            Console.WriteLine("AbsBaseClass::PrivateMethod()");
        }
       
        public abstract void AbstractMethod();
               
    }

HTH
Babu
 



-------------------------------

Guys,

I am quite new to C-Sharp , so please bear fro a few days.

Talking of abstract classes :

abstract class AbstractFactory
{
 // Methods
 abstract public AbstractProductA CreateProductA();
 abstract public AbstractProductB CreateProductB();
}

Can the abstract classes have private members?

Please reply.

---------------------------------------------------------------------------
       "This e-mail and any files transmitted with it are for the sole use
of the intended recipient(s) and may contain confidential and privileged
information. If you are not the intended recipient, please contact the
sender by reply e-mail and destroy all copies of the original message.

       Any unauthorized review, use, disclosure, dissemination, forwarding,
printing or copying of this email or any action taken upon this e-mail is
strictly prohibited and may be unlawful."
---------------------------------------------------------------------------


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/Microsofts_C_Sharp/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to