C#.NET Abstract method

Abstract method is a method which is created using "abstract"keyword.

It doesn't have any implementation or body.

It will have only signature.

Semicolon is required at the end of signature.

It is implemented in the class which inherits it.

Syntax for creating abstract method

abstract keyword access specifier return_type method_name(input parameters)

Example

abstract public long add(int a,int b);
Thursday, 31 December 2015
Posted by Sudhir Chekuri
Tag :

C#.NET Method with arguments and return type

It is one of the method that contains both arguments and return type.

Example

public long add(int a,int b)

{

return a+b;

}
Posted by Sudhir Chekuri
Tag :

C#.NET Method with Return Type

It is one of the method that doesn't have any arguments/parameters. It contains only return type.

Example

public int add()

{

Console.WriteLine("addition");

return 1;

}

A method can return value to anything which is capable of holding that value.

Example


int i=add();

Console.WriteLine(i);//1

Explanation

In the above example the add method can return value'1' to i and it will be printed as output.
Posted by Sudhir Chekuri
Tag :

C#.NET Method with arguments

It is one type of method and consists of arguments/parameters.

Example

public long add(int a,int b)

{

Console.WriteLine(a+b);

}

Explanation


In the above example the add() can take two values of int type as inputs and doesn't return any type because long data type is a return type but in body section there is no return type.
Posted by Sudhir Chekuri
Tag :

C#.NET Simple Method

Simple method is a method that doesn't have any arguments and return type.

Syntax

Access specifier return type methodname( )

Example

public void add()

{

Console.WriteLine("addition");

}
Posted by Sudhir Chekuri
Tag :

C#.NET Methods

  • Method is a piece of code which is used to perform a particular task.
  • A Method can be either no value returning or value returning.
  • If it was a no value returning we will use void as return type for that method. 
  • If it was a value returning we use a specific type i.e., what type of value that a method returns. 
Syntax for creating a method

Access specifier return type methodname( )
{

}

Access Specifier : It is used to define the accessibility level of a method.

Example for access specifiers are public, private, protected etc.

ReturnType: What type of value return by a method is given as return type.

Method name:
The name of a method to call it.

Example

public void add()

{

//Code Logic

}

There are different types of methods 
  1. C#.NET Simple Method
  2. C#.NET Method with arguments
  3. C#.NET Method with return type
  4. C#.NET Method with arguments and return type 
  5. C#.NET Abstract Method
  6. C#.NET Static Method
Posted by Sudhir Chekuri
Tag :

C#.NET OOPS

OOPS stands for Object Oriented Programming Structure.

It was a new approach in programming introduced in 1970's when a suffered problems with procedural programming languages like lack of security and reusability.

Object Oriented approach provides us security and reusability of the code.

To call a language as Object Oriented it needs to satisfy a set of rules prescribed by an approach. Those are:

  1. Encapsulation
  2. Abstraction
  3. Inheritance
  4. Polymorphism
Posted by Sudhir Chekuri
Tag :

Followers

Total Pageviews

Powered by Blogger.

- Copyright © 2013 DevStudent - Metrominimalist - Powered by Blogger - Designed by Johanes Djogan -