본문 바로가기

전체 글

abstract interface using System; interface IAdd { int Add(int a, int b); } interface IMinus { int Minus(int a , int b); } abstract class abMethod { public int Add(int a, int b) { int tot = a+b; return tot; } public abstract int Minus(int a, int b); } class NewInter : IAdd , IMinus { public int Add(int a, int b) { int add= a+b; return add; } public int Minus(int a, int b) { int m = a-b; return m; } } class ABtest :.. 더보기
DB 저장프로시저 연습 프로시저 INSERT 문 프로시저 수정후~!!!!!!! 만들어져서 저장되는시간이걸린다 그래서 수정후 바로 적용안되는 경우가 있다 만들고나서 10초정도 딜레이한 시간이 필요하다 USE pubs USE pubs CREATE PROC au_info @lastname varchar(40), @firstname varchar(20) AS SELECT a.au_lname, a.au_fname, t.title, p.pub_name FROM authors AS a INNER JOIN titleauthor AS ta ON a.au_id = ta.au_id INNER JOIN titles AS t ON t.title_id = ta.title_id INNER JOIN publishers AS p ON t.pub_id = p.pub_id WHERE .. 더보기
프로퍼티 인덱서 ///// 프로퍼티 ///////// using System; class test { private int a; public int A { get { Console.Write("get"); this.a = a+2; return a; } set { Console.WriteLine("set"); this.a = value; } } } class jks { static void Main() { test t = new test(); t.A = 2; Console.WriteLine("{0}",t.A); } } using System; class jksPro { private string Name; public string NameP { get { string newName = this.Name + "추가문장"; .. 더보기
연산자 메서드 operator +(), operator-() , 연산자 오버로딩? 연산자 메서드를 부르려면 해당 연산자를 사용하며, 연산자를 사용하면 코드가 훨씬 직관적이기 때문에 이해하기 쉬워진다 using System; class Point { public int x; public int y; public Point( int x, int y ) { this.x = x; this.y = y; } public override string ToString() { // (x,y) 값 return String.Format("({0},{1})", x, y ); } // + 연산자 메서드 public static Point operator +(Point pt1, Point pt2) { return (new Point(pt1.x + pt2.x, pt1.y + pt2.y)); } // - 연산자 .. 더보기
static정적맴버 배열 연산자 is/as foreach 문 메서드 오버로딩 메서드 가변 인자 정적(static) 멤버 일반적인 객체 사용 방법은 클래스를 정의하고, 여러 개의 인스턴스를 생성 현재 생성된 총 인스턴스 수를 구하려면 정수형 변수를 두고 인스턴스를 생성할 때마다 하나씩 증가 인스턴스간에 공유해야 하는 값이 필요한 경우, 정적(static) 멤버를 사용 using System; class Point { public Point() { bbb++; Console.WriteLine("생성"+ bbb); } public int bbb = 0; // static int bbb = 0;v // 스택틱하면 값이 더해진다 } class jks { static void Main() { Point pt = new Point(); Point pt1 = new Point(); } } 배열////// usi.. 더보기
인터페이스(interface) 와 추상화클래스(abstract) 예제 using System; namespace test_cal { interface IAdd { int Add(int i, int j); } interface IMnus { int Minus(int i, int j); } abstract class abMethod { public int Add(int i , int j) { int tot = i +j; return tot; } public abstract int Minus(int i ,int j); } class NewabMethod : abMethod { public override int Minus(int i, int j) { int m = i -j; return m; } } class NewInter : IAdd, IMnus { public int Ad.. 더보기
저장프로시저 예제 USE pubs GO ALTER PROC usp_titleSelectArow ( @title_id VARCHAR(6) = 'MC2222', @result CHAR(12) OUTPUT-- 값을 돌려받기위한 매개변수 값을 출력하기위해쓴다 )AS-- 만약에 OUTPUT 이없으면 대체 -> @pub_id CHAR(4) = '1389' SELECT @result = type FROM titles-- type 이라는글자가 @result에들어간다 WHERE title_id = @title_id -- 만약에 AND pub_id = @pub_id 추가~!! GO SELECT type FROM titles WHERE title_id = 'BU1032' -- ,MC2222 DECLARE @res CHAR(12) -- 변수 .. 더보기
쿼리 교도소 탈출하기 풀어보자 더보기