GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Concepts  >  OOPS
Go To First  |  Previous Question  |  Next Question 
 OOPS  |  Question 32 of 68    Print  
Define Inteface , Implement a class , method , clearly with simple examples , Instance class

  
Total Answers and Comments: 1 Last Update: February 27, 2007     Asked by: venkatu2005 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
February 27, 2007 12:13:53   #1  
kashinathn Member Since: June 2006   Contribution: 4    

RE: Define Inteface , Implement a class , method , cl...

Interfaces like classes define a set of properties methods and events. But unlike classes interfaces do not provide implementation. They are implemented by classes and defined as separate entities from classes.

< @ Page Language "C#" >
<script runat "server">

//private variables
private IDataSource m_DataSource null;

public void Page_Load(Object sender EventArgs E) {

//main
m_DataSource new AccessDataSource();
Response.Write("Connection string " + m_DataSource.ConnectionString + "<br/>");
Response.Write("Test result " + m_DataSource.Test() + "<br/>");

}

public interface IDataSource {
string ConnectionString { get; }
string Test();
}

public class AccessDataSource : IDataSource {

//constants
public const string CONNECTION_STRING "Server ....;bla...bla...bla...";

public string ConnectionString {
get { return CONNECTION_STRING; }
}

public string Test() {
return "this is a test";
}

}

</script>


 
Is this answer useful? Yes | No

 Related Questions

From a practical programming viewpoint, polymorphism exists in three distinct forms in Java: Method overloading Method overriding through inheritance Method overriding through the Java interface  
Latest Answer : Method OverloadingMethod OverridingOperator OverloadingThese are the different forms of Polymorphism in Java. ...

Latest Answer : WELL DESIGNED MODULES ALWAYS HIDES ALL OF ITS IMPLEMENTAIONS DETAILS. MODULES THEN COMMUNICATE WITH EACH OTHER ONLY THROUGH API's UNKNOW TO EACH OTHER INNER IMPLEMENTATIONSPROPER USE OF ACCESS MODIFIERS (PRIVATE,PUBLIC,PROTECTED) IS MUST FOR INFORMATION ...
Read Answers (6) | Asked by : harsha

Can we create a object of Base class?..If we can not create a object of base class then why we need Abstract class?
Read Answers (5) | Asked by : abhishek
Tags : Abstract

Latest Answer : Actually size of class having no variable but only 1 function is determined by the variables size declared in that fuction. So the size of the class will be the total size of variables which have been declared in that member function. ...
Read Answers (4) | Asked by : anamika

Latest Answer : ans: using Templates ...
Read Answers (2) | Asked by : kavitha

Latest Answer : For more explanation, you can see in my  previous answer that we can inherit, but we can not access it from the derived class. ...
Read Answers (7) | Asked by : Anjaly

Latest Answer : When you create a custom type (class) in any language, that class in OOP is called Object and when you create an istance of this class just as we create instance of built-in types e.g. (int a,float b) it is called instance of the object. ...

Latest Answer : Interfaces, like classes, define a set of properties, methods, and events. But unlike classes, interfaces do not provide implementation. They are implemented by classes, and defined as separate entities from classes.

Latest Answer : Classes and objects are separate but related concepts. Every object belongs to a class and every class contains one or more related objects. A Class is static. The attributes of a class don't change. An Object on the other hand has a limited lifespan. ...

Latest Answer : A Factory class is one that is used to return instances of other classes. This is generally used in the context of Factory Design Pattern. ...
Read Answers (1) | Asked by : ashray


 Sponsored Links

 
Related Articles

Concepts of Object-Oriented Programming

Object Oriented JavaScript In this chapter you ll learn about OOP Object Oriented Programming and how it relates to JavaScript As an ASP NET developer you probably have some experience working with objects and you may even be familiar with concepts such as inheritance However unless you re already a
 

OOPS Tutorials

Object oriented programming OOP is a computer science term used to characterize a programming language that began development in the 1960&rsquo; s The term object oriented programming&rsquo; was originally coined by Xerox PARC to designate a computer application that describes the methodol
 

C++ Pure Virtual Function and Base Class

C Pure Virtual Function and Virtual Base Class In this C tutorial you will learn about pure virtual function declaration of pure virtual function and virtual base class virtual base class and how to implement a virtual base class explained with examples mosgoogle center What is Pure Virtual Function
 

SOA Concepts

SOA Concepts Today the concept of Service Oriented Architecture has become ubiquitous Evidence from recent years establish that SOA is not just about hype but a part of every major Business environment The truth is Service Oriented Architecture can be beneficial to Business only when it is utilized
 

How to Access C++ Class Members

How to Access C Class Members In this C tutorial you will learn how to access Class members dot operator or class member access operator difference between struct and class and&nbsp; scope resolution operator mosgoogle center It is possible to access the class members after a class is defined an
 

What is Common Data Modeling Method

Common Data Modeling is one of the core considerations when setting up a business data warehouse. Any serious company wanting to have a data warehouse will have to be first serious about data models. Building a data model takes time and it is not unusual for companies to spend two to five years just
 

How to define command line arguments

The main functions can have arguments passed which are called as command line arguments. There are two command line arguments: Argument count denoted by argc and Argument vector denoted by argv The argc is an integer variable which denotes the number of parameters passed and argv is pointer to a
 

Simple Tips to follow Before You Quit Job

You don&rsquo;t have to force yourself to work in a company you don&rsquo;t like. You can easily transfer to another company or just quit and take it easy until a new opportunity comes. Working in a company that you are not at ease will only give you stress and could be dangerous for your he
 

The Interview Snafu

How to turn someone else&rsquo;s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

Winning a Job Interview with a Winning Resume

Does your resume unlock your potential, take your skills to the highest level and win you the interview and the job you want now? The job market today is highly competitive and even if you think you have what it takes to get an interview you won&rsquo;t get over the line without a polished, prof
 

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