Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A C# question. A class Employee field salary need to be declared constant like public class Employee() { private string name; private constant int salary

A C# question.

A class "Employee" field "salary" need to be declared constant like

public class Employee()

{

private string name;

private constant int salary = 2500

so the constructor is like

public Employee (string name, int salary){

this.name= name;

this. salary = salary;}

what is wrong with this piece of code. the error is

Error CS0176 Member 'employee.salary' cannot be accessed with an instance reference; qualify it with a type name instead

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 2005 Databases

Authors: Karli Watson

1st Edition

0470044063, 978-0470044063

More Books

Students also viewed these Databases questions

Question

5. Describe the visual representations, or models, of communication

Answered: 1 week ago