Click here to Skip to main content
15,913,055 members
Home / Discussions / C#
   

C#

 
QuestionConverting Crystal Reports into Bitmap format Pin
itani1-Oct-14 20:03
itani1-Oct-14 20:03 
QuestionRe: Converting Crystal Reports into Bitmap format Pin
Richard MacCutchan1-Oct-14 21:43
mveRichard MacCutchan1-Oct-14 21:43 
AnswerRe: Converting Crystal Reports into Bitmap format Pin
Bernhard Hiller1-Oct-14 23:18
Bernhard Hiller1-Oct-14 23:18 
GeneralRe: Converting Crystal Reports into Bitmap format Pin
Richard MacCutchan1-Oct-14 23:19
mveRichard MacCutchan1-Oct-14 23:19 
AnswerRe: Converting Crystal Reports into Bitmap format Pin
Marco Bertschi1-Oct-14 23:57
protectorMarco Bertschi1-Oct-14 23:57 
GeneralRe: Converting Crystal Reports into Bitmap format Pin
Richard MacCutchan2-Oct-14 3:50
mveRichard MacCutchan2-Oct-14 3:50 
GeneralRe: Converting Crystal Reports into Bitmap format Pin
jschell3-Oct-14 9:18
jschell3-Oct-14 9:18 
GeneralRe: Converting Crystal Reports into Bitmap format Pin
Marco Bertschi4-Oct-14 2:17
protectorMarco Bertschi4-Oct-14 2:17 
GeneralRe: Converting Crystal Reports into Bitmap format Pin
jschell6-Oct-14 10:01
jschell6-Oct-14 10:01 
AnswerRe: Converting Crystal Reports into Bitmap format Pin
Gerry Schmitz3-Oct-14 4:48
mveGerry Schmitz3-Oct-14 4:48 
AnswerRe: Converting Crystal Reports into Bitmap format Pin
Pete O'Hanlon1-Oct-14 23:50
mvePete O'Hanlon1-Oct-14 23:50 
GeneralRe: Converting Crystal Reports into Bitmap format Pin
Marco Bertschi1-Oct-14 23:54
protectorMarco Bertschi1-Oct-14 23:54 
AnswerRe: Converting Crystal Reports into Bitmap format Pin
Marco Bertschi1-Oct-14 23:52
protectorMarco Bertschi1-Oct-14 23:52 
QuestionUsing generics without the caller knowing what type to expect Pin
Jörgen Andersson1-Oct-14 9:00
professionalJörgen Andersson1-Oct-14 9:00 
AnswerRe: Using generics without the caller knowing what type to expect Pin
Eddy Vluggen1-Oct-14 9:07
professionalEddy Vluggen1-Oct-14 9:07 
GeneralRe: Using generics without the caller knowing what type to expect Pin
Jörgen Andersson1-Oct-14 21:14
professionalJörgen Andersson1-Oct-14 21:14 
GeneralRe: Using generics without the caller knowing what type to expect Pin
PIEBALDconsult1-Oct-14 9:41
mvePIEBALDconsult1-Oct-14 9:41 
GeneralRe: Using generics without the caller knowing what type to expect Pin
Jörgen Andersson1-Oct-14 21:30
professionalJörgen Andersson1-Oct-14 21:30 
AnswerRe: Using generics without the caller knowing what type to expect Pin
Pete O'Hanlon1-Oct-14 21:23
mvePete O'Hanlon1-Oct-14 21:23 
GeneralRe: Using generics without the caller knowing what type to expect Pin
Jörgen Andersson1-Oct-14 21:35
professionalJörgen Andersson1-Oct-14 21:35 
AnswerRe: Using generics without the caller knowing what type to expect Pin
jschell3-Oct-14 9:20
jschell3-Oct-14 9:20 
AnswerRe: Using generics without the caller knowing what type to expect Pin
aljodav3-Oct-14 18:22
aljodav3-Oct-14 18:22 
QuestionUsing protected set accessor Pin
robwm11-Oct-14 6:23
robwm11-Oct-14 6:23 
Hi,

I'm working on a course for 98-361 Software Development Fundamentals. I am given the following example:

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace Lesson02
{
    
    abstract class Polygon
    {
        public double Length {get; protected set;}
        public double Width {get; protected set;}
        abstract public double GetArea();
    }
    
    class Rectangle: Polygon
    {
        public Rectangle(double length, double width)
        {
            Length = length;
            Width = width;
        }

        public override double GetArea()
        {
            return Width * Length;
        }

    }

    class Program
    {
        static void Main(string[] args)
        {
            Rectangle rect = new Rectangle(10, 20);
            Console.WriteLine(
                "Width={0}, Length={1}, Area = {2}",
                rect.Width, rect.Length, rect.GetArea());
        }

    }
}


Here is a paragraph from the text that I am struggling with:

The properties Length and Width in the Polygon class are declared with a protected access modifier for the set accessor. This means that access to the set accessor is available only inside the Polygon class and its derived classes. You can still get the value of the Length and Width properties in the Main method, but you’ll get an error if you attempt to assign a value to these properties.

What I would like to know is to see code that shows how to use the set accessor properly and what does it look like if you try to assign a value from Main. I understand it will fail but I'd like to see it for myself. I am new to C# and unsure of how to introduce the code myself for an accurate demo.

Unfortunately, my instructors apparently don't write code so they are unable to answer my question.

Thank you!
Rob

modified 1-Oct-14 12:32pm.

AnswerRe: Using protected set accessor Pin
BillWoodruff1-Oct-14 7:00
professionalBillWoodruff1-Oct-14 7:00 
GeneralRe: Using protected set accessor Pin
robwm11-Oct-14 7:17
robwm11-Oct-14 7:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.