Thread: Property Methods, Constructors ??

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    1

    Property Methods, Constructors ??

    Hey, wondering if you could help with part of my C# program. How do I make a read/write property method, a default constructor, and an Overloaded Constructor? Here are the instructions if this helps:

    Create a read/write property method for each of the class variables. Check the values of the arguments for the set methods that update the product number and the on hand quantity. Only update the class variables if the arguments values are greater than zero. Check the values of the arguments for the set methods that update the description and the on hand quantity. Only update the class variables if the arguments values are not blank (null or "").

    Create a default constructor for the Product class. Initialize the product number and the on hand quantity to zero. Initialize the description to "no description". Initialize the unit of measure to "no unit of measure".

    Create an overloaded constructor that takes four arguments - one each for the product number, description, on hand quantity, and unit of measure.

  2. #2
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,110
    How do I make a read/write property method
    second hit in google (keywords: C# getter setter ): http://www.c-sharpcorner.com/UploadF...rtiesInCS.aspx

    a default constructor, and an Overloaded Constructor?
    second hit in google(keywords: C# constructor overloading):
    http://www.codeproject.com/dotnet/Co...select=1703188

    I know it seems cheap to just give links instead of explaining, but on this board the rule is simple: show that you have tried and we will try.

    Just asking a question without any proof that you have read on the subject or tried anything is as simple as asking for a google answer...

    But since this is your first post i'll not start flaming or anything, a simple welcome will do.

    Welcome!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. static property
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 06-12-2008, 01:03 AM
  2. C++/CLI Property
    By psychopath in forum Windows Programming
    Replies: 5
    Last Post: 07-11-2006, 09:45 PM
  3. Lesson #5 - Methods
    By oval in forum C# Programming
    Replies: 1
    Last Post: 05-04-2006, 03:09 PM
  4. Problem with a file parser.
    By Hulag in forum C++ Programming
    Replies: 7
    Last Post: 03-17-2005, 09:54 AM
  5. Property Sheets :: MFC
    By kuphryn in forum Windows Programming
    Replies: 0
    Last Post: 05-09-2002, 03:04 PM