GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Microsoft  >  C#
Go To First  |  Previous Question  |  Next Question 
 C#  |  Question 346 of 436    Print  
Can we use Friend Classes or functions in C# the way we use it in C++

  
Total Answers and Comments: 2 Last Update: January 06, 2007     Asked by: nitin 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
June 30, 2006 07:57:45   #1  
Ashishtandon.e Member Since: March 2006   Contribution: 14    

RE: Can we use Friend Classes or functions in C# the w...

No we can not use friend keyword but instead c# provide internal keyword for friend


 
Is this answer useful? Yes | No
January 06, 2007 14:32:08   #2  
       

RE: Can we use Friend Classes or functions in C# the w...
In VB.Net Friend keyword is an equivalent to internal of C#
 
Is this answer useful? Yes | No

 Related Questions

No. C# does not have macros. Keep in mind that what some of the predefined C macros (for example, __LINE__ and __FILE__) give you can also be found in .NET classes like System.Diagnostics (for example, 
Latest Answer : Ans:No ...

I was trying to use an "out int" parameter in one of my functions. How should I declare the variable that I am passing to it?
You should declare the variable as an int, but when you pass it in you must specify it as 'out', like the following: int i;foo(out i);where foo is declared as follows: [return-type] foo(out int 

Original Visual J++ code: public synchronized void Run() {// function body}Ported C# code: class C{public void Run(){lock(this){// function body }}public static void Main() {}}  

From language spec:The list of similarities between classes and structs is as follows. Longstructs can implement interfaces and can have the same kinds of members as classes. Structs differ from classes 
Latest Answer : Following are the main points of difference between classes and structs in C#:Value type vs Reference type: Structs are value type and classes are reference type. Whenever a struct object is assigned to another struct object a copy is created. In case ...

Casting the char to an int will give you the ASCII value: char c = 'f';System.Console.WriteLine((int)c);or for a character in a string: System.Console.WriteLine((int)s[3]);The base class libraries 
Latest Answer : Ans:// Create an ASCII encoding.            Encoding ascii = Encoding.ASCII;The base class libraries also offer ways to do this with the Convert class or Encoding classes if you need a particular ...

From a versioning perspective, what are the drawbacks of extending an interface as opposed to extending a class?
With regard to versioning, interfaces are less flexible than classes. With a class, you can ship version 1 and then, in version 2, decide to add another method. As long as the method is not abstract (i.e., 

Is it possible to restrict the scope of a field/method of a class to the classes in the same namespace?
There is no way to restrict to a namespace. Namespaces are never units of protection. But if you're using assemblies, you can use the 'internal' access modifier to restrict access to only 

By using the Registry and RegistryKey classes in Microsoft.Win32, you can easily access the registry. The following is a sample that reads a key and displays its value: using System;using Microsoft.Win32;class 
Latest Answer : Ans:By using the Registry and RegistryKey classes in Microsoft.Win32 ...

Classes in the same namespace.  
Latest Answer : Its available only to the derived classes and not all the classes in the NameSpace ...

It is available to derived classes and classes within the same Assembly (and naturally from the base class it is declared in).  
Latest Answer : Ans:protected internal is available to derived classes and classes within the same Assembly (and naturally from the base class it is declared in). function checkf(form) { var f = document.form1;if (document.form1.cmt.value=='') { alert('Please enter ...


 Sponsored Links

 
Related Articles

ODP.NET - Fundamental ODP.NET Classes to Retrieve Data

ODP NET Fundamental ODP NET Classes to Retrieve Data To retrieve data from an Oracle database using ODP NET we need to work with a few of the ODP NET classes At this point we will discuss the most fundamental classes available in ODP NET for retrieving data mosgoogle The following is the list of fun
 

Microsoft AJAX Library - C# and JavaScript Classes

C and JavaScript Classes For the purpose of demonstrating a few more OOP related concepts we ll use another class Our new class is named Table and it has two public fields rows columns and one method getCellCount The getCellCount method should return the number of rows multiplied by the number of co
 

Microsoft AJAX Library - JavaScript Classes

JavaScript Classes Not only can JavaScript functions contain other functions but they can also be instantiated This makes JavaScript functions a good candidate for implementing the concept of a class from traditional object oriented programming This is very helpful feature indeed because JavaScript
 

Microsoft AJAX Library - Anonymous Functions

Anonymous Functions Anonymous functions can be created adhoc and used instead of a named function Although this can hinder readability when the function is more complex you can do this if you don t intend to reuse a function s code In the following example we pass such an anonymous function to Displ
 

Microsoft AJAX Library - Functions as Variables

Functions as Variables In JavaScript functions are first class objects This means that a function is regarded as a data type whose values can be saved in local variables passed as parameters and so on For example when defining a function you can assign it to a variable and then call the function thr
 

Microsoft AJAX Library - JavaScript Functions

JavaScript Functions A simple fact that was highlighted in the previous chapter but that is often overlooked is key to understanding how objects in JavaScript work code that doesn t belong to a function is executed when it s read by the JavaScript interpreter while code that belongs to a function is
 

ERPAdvantages for Management Functions

ERP Advantages for Management Functions ERP management systems provide a technology platform in which organizations can integrate and coordinate their main internal business processes They use this to fight against the problem of the organizational inefficiency brought on by the use of different sys
 

C++ Static Functions

C Static Functions Static member functions have a class scope and they do not have access to the this pointer of the class When a member is declared as static a static member of class it has only one data for the entire class even though there are many objects created for the class The main usage of
 

C++ Virtual Functions

C Virtual Functions What are Virtual Functions Virtual as the name implies is something that exists in effect but not in reality The concept of virtual function is the same as a function but it does not really exist although it appears in needed places in a program The object oriented programming la
 

C++ Inline Functions

C Inline Functions In this C tutorial you will learn about Inline function what is inline function reason for the need of inline function what happens when an inline function is written general format of inline function explained with example mosgoogle center What is Inline Function Inline functions
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape