473,499 Members | 1,716 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Inconsistent accessibility: return type

1 New Member
I have the following code, but it is error when I build it. Can you help me?

Can you tell me more about 'Inconsistent accessibility: return type', 'Inconsistent accessibility: parameter type'.

using System;
public class Tinh_khoang_cach_Ham_tu_dinh_nghia
{
struct DIEM
{
public Double x;
public Double y;
}
public static void Main()
{ // Khai báo biến nhập
DIEM A; //Double xA, yA;
DIEM B; //xB, yB;


// Khai báo biến xuất
Double Kq;

// Các lệnh nhập liệu
A = Nhap_diem();
B = Nhap_diem();
/*
Console.Write("Hoành độ A = ");
A.x = Double.Parse(Console.ReadLine()); // Chua xem xét người dùng nhập chuỗi
Console.Write("Tung độ A = ");
A.y = Double.Parse(Console.ReadLine()); // Chua xem xét người dùng nhập chuỗi

Console.Write("Hoành độ B= ");
B.x = Double.Parse(Console.ReadLine()); // Chua xem xét người dùng nhập chuỗi
Console.Write("Tung độ B = ");
B.y = Double.Parse(Console.ReadLine()); // Chua xem xét người dùng nhập chuỗi */

// Lệnh xử lý
Kq = Khoang_cach(A, B);
/*
Double Dx = B.x - A.x;
Double Dy = B.y - A.y;
Kq = Math.Sqrt(Dx * Dx + Dy * Dy); */


// Các lệnh kết xuất
String Chuoi = String.Format("Khoảng cách là: (0:F2)", +Kq);
Console.Write(Chuoi);
Console.ReadLine();

}
public static DIEM Nhap_diem()
{
DIEM Kq;
Console.Write("Hoành độ = ");
Kq.x = Double.Parse(Console.ReadLine()); // Chua xem xét người dùng nhập chuỗi
Console.Write("Tung độ = ");
Kq.y = Double.Parse(Console.ReadLine()); // Chua xem xét người dùng nhập chuỗi
return Kq;
}
public static double Khoang_cach(DIEM A, DIEM B)
{
Double Kq;
Double Dx = B.x - A.x;
Double Dy = B.y - A.y;
Kq = Math.Sqrt(Dx * Dx + Dy * Dy);
return Kq;
}

}
Aug 8 '07 #1
1 3207
Plater
7,872 Recognized Expert Expert
Well, I don't think i've ever seen those particular errors, but I would say they have something to do with using a struct as a return type?
Which lines of code are giving the error?

I have the following code, but it is error when I build it. Can you help me?

Can you tell me more about 'Inconsistent accessibility: return type', 'Inconsistent accessibility: parameter type'.
Expand|Select|Wrap|Line Numbers
  1. using System;
  2. public class Tinh_khoang_cach_Ham_tu_dinh_nghia
  3. {
  4.     struct DIEM
  5.     {
  6.         public Double x;
  7.         public Double y;
  8.     }
  9.     public static void Main()
  10.     {   // Khai báo biến nhập 
  11.         DIEM A; //Double xA, yA;
  12.         DIEM B; //xB, yB;
  13.  
  14.  
  15.         // Khai báo biến xuất 
  16.         Double Kq;
  17.  
  18.         // Các lệnh nhập liệu 
  19.         A = Nhap_diem();
  20.         B = Nhap_diem();
  21.         /*
  22.         Console.Write("Hoành độ A = ");
  23.         A.x = Double.Parse(Console.ReadLine()); // Chua xem xét người dùng nhập chuỗi
  24.         Console.Write("Tung độ A = ");
  25.         A.y = Double.Parse(Console.ReadLine()); // Chua xem xét người dùng nhập chuỗi
  26.  
  27.         Console.Write("Hoành độ B= ");
  28.         B.x = Double.Parse(Console.ReadLine()); // Chua xem xét người dùng nhập chuỗi
  29.         Console.Write("Tung độ B = ");
  30.         B.y = Double.Parse(Console.ReadLine()); // Chua xem xét người dùng nhập chuỗi */
  31.  
  32.         // Lệnh xử lý 
  33.         Kq = Khoang_cach(A, B);
  34.         /*
  35.         Double Dx = B.x - A.x;
  36.         Double Dy = B.y - A.y;
  37.         Kq = Math.Sqrt(Dx * Dx + Dy * Dy); */
  38.  
  39.  
  40.         // Các lệnh kết xuất 
  41.         String Chuoi = String.Format("Khoảng cách là: (0:F2)", +Kq);
  42.         Console.Write(Chuoi);
  43.         Console.ReadLine();
  44.  
  45.     }
  46.     public static DIEM Nhap_diem()
  47.     {
  48.         DIEM Kq;
  49.         Console.Write("Hoành độ  = ");
  50.         Kq.x = Double.Parse(Console.ReadLine()); // Chua xem xét người dùng nhập chuỗi
  51.         Console.Write("Tung độ  = ");
  52.         Kq.y = Double.Parse(Console.ReadLine()); // Chua xem xét người dùng nhập chuỗi
  53.         return Kq;
  54.     }
  55.     public static double Khoang_cach(DIEM A, DIEM B)
  56.     {
  57.         Double Kq;
  58.         Double Dx = B.x - A.x;
  59.         Double Dy = B.y - A.y;
  60.         Kq = Math.Sqrt(Dx * Dx + Dy * Dy);
  61.         return Kq;
  62.     }
  63.  
  64. }
Aug 8 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
67993
by: Sunit Joshi | last post by:
I get this message "Inconsistent accessibility: return type 'TimeTracker.TrackerObjects.Project' is less accessible than method 'TimeTracker.TrackerObjects.GetProject(int)'" Here's the code...
5
2649
by: hodari | last post by:
My program compiles correctly in VS 2003 but fails in VS2005 Express Edition - I get a compile error Inconsistent accessibility: return type 'VA.Customer' is less accessible than method...
5
27233
by: Andy Fish | last post by:
Consider the following code fragment public class Wrapper { protected enum E { IN, OUT }; public class C { protected void foo(E e) { } } } I want the class C to be accessible from outside...
3
37050
by: AAV | last post by:
what is wrong with the code i get 'Error 1 Inconsistent accessibility: parameter type 'ConsoleApplication1.Garage.CarDelegate' is less accessible than method...
0
981
by: mariano774 | last post by:
Hello, I'm building a POC architecture framework, in which I have my business objects (BOs) made of internal classes and my transfer objects (TOs) made of public classes. what I'd like to do is...
20
2577
by: Francine.Neary | last post by:
I am learning C, having fun with strings & pointers at the moment! The following program is my solution to an exercise to take an input, strip the first word, and output the rest. It works fine...
3
4399
by: WillyL | last post by:
I keep getting the following error message: Inconsistent accessibility: return type 'System.Collections.Generic.IEnumerable<Iteraties.Aandeel>' is less accessible than method...
3
3190
by: EvilProject | last post by:
While working on a scripting engine I Encountered the following problem. First I Created an abstract base class EPType that represent a variable type in the script. internal abstract class...
9
5121
by: dylan.miller | last post by:
I'm having trouble understanding the internal access modifier. There are many classes in my assembly that should not be accessible outside of the assembly. I've used the internal access modifier...
0
7006
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6892
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7385
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5467
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4917
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4597
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3096
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3088
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
294
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.