'Programming > openGL' 카테고리의 다른 글
| glColor* (0) | 2015.07.20 |
|---|---|
| 우분투에서 openGL 시작하기 (0) | 2015.07.20 |
| openGL state variables (0) | 2013.12.12 |
| openGL에서 AVI 동영상 재생하기 (0) | 2013.04.09 |
| openGL gcc에서 컴파일 하기 (0) | 2012.06.02 |
| glColor* (0) | 2015.07.20 |
|---|---|
| 우분투에서 openGL 시작하기 (0) | 2015.07.20 |
| openGL state variables (0) | 2013.12.12 |
| openGL에서 AVI 동영상 재생하기 (0) | 2013.04.09 |
| openGL gcc에서 컴파일 하기 (0) | 2012.06.02 |
#include < iostream >
using namespace std;
int main(int argc, char **argv)
{
int a = 12;
int b = 1;
double c = 0;
try
{
if(b == 0) throw(b);
else throw(c);
}
catch(int e)
{
cout << "divide by zero. throw " << e << endl;
}
catch(double e)
{
cout << "good job. throw " << e << endl;
}
return 0;
}
| #include <exception> [링크 : http://www.cplusplus.com/reference/exception/exception/ ] |
| c -> cpp 추가사항 (0) | 2014.03.10 |
|---|---|
| 오버로딩 / 오버라이딩 (0) | 2014.03.10 |
| 연산자 오버로딩 (0) | 2014.03.04 |
| c++ explicit (0) | 2014.02.28 |
| c++ class / const member variable & function (0) | 2014.02.28 |
#include < iostream >
using namespace std;
class temp
{
public:
int a;
temp(int b) : a(b) {}
int operator+(int b, int c) { a += b; return a; }
};
int main(int argc, char **argv)
{
temp tt(1);
cout << tt + 3;
return 0;
}| error C2804: 이항 'operator +'에 매개 변수가 너무 많습니다. |
| error: ‘int temp::operator+(int, int)’ must take either zero or one argument |
#include < iostream >
using namespace std;
class temp
{
public:
int a;
temp(int b) : a(b) {}
// int operator+(int b) { a += b; return a; }
friend int operator+(temp t, int b)
{
t.a = t.a + b;
return t.a;
}
};
int main(int argc, char **argv)
{
temp tt(1);
cout << tt + 3;
return 0;
}| 오버로딩 / 오버라이딩 (0) | 2014.03.10 |
|---|---|
| try - throw - catch (0) | 2014.03.05 |
| c++ explicit (0) | 2014.02.28 |
| c++ class / const member variable & function (0) | 2014.02.28 |
| deep copy / shallow copy < object copy (0) | 2014.02.27 |
| try - throw - catch (0) | 2014.03.05 |
|---|---|
| 연산자 오버로딩 (0) | 2014.03.04 |
| c++ class / const member variable & function (0) | 2014.02.28 |
| deep copy / shallow copy < object copy (0) | 2014.02.27 |
| crt0.o / crtexe.obj (0) | 2014.02.27 |
| constructor(variables ...) : const variable(parameter) |
| class class_name { const int key; // const member variable class_name(int _key) : key(_key) { } }; |
class student
{
const int id;
int age;
char name[20];
char subject[30];
public:
student()
{
}
student(int _id) : id(_id)
{
}
student(int _id, int _age, char *_name, char *_subject) : id(_id)
{
age = _age;
// id = _id;
strcpy(name, _name);
strcpy(subject, _subject);
}
| 1>d:\cpp\ch12\ch12\ch12.cpp(13): error C2758: 'student::id' : 생성자 기본/멤버 이니셜라이저 목록에 초기화해야 합니다.
1> d:\cpp\ch12\ch12\ch12.cpp(7) : 'student::id' 선언을 참조하십시오.
1>d:\cpp\ch12\ch12\ch12.cpp(44): error C2582: 'operator =' 함수는 'student'에서 사용할 수 없습니다. |
| ret_type function(parameter ...) const |
| 연산자 오버로딩 (0) | 2014.03.04 |
|---|---|
| c++ explicit (0) | 2014.02.28 |
| deep copy / shallow copy < object copy (0) | 2014.02.27 |
| crt0.o / crtexe.obj (0) | 2014.02.27 |
| c++ constructor (0) | 2014.02.26 |
| c++ explicit (0) | 2014.02.28 |
|---|---|
| c++ class / const member variable & function (0) | 2014.02.28 |
| crt0.o / crtexe.obj (0) | 2014.02.27 |
| c++ constructor (0) | 2014.02.26 |
| C++11 Lambda Fuction (2) | 2013.11.20 |
| 1> LINK : D:\cpp\ch9\Debug\ch9.exe을(를) 찾을 수 없거나 마지막 증분 링크에 의해 빌드되지 않았습니다. 전체 링크를 수행하고 있습니다.
1>MSVCRTD.lib(crtexe.obj) : error LNK2019: _main 외부 기호(참조 위치: ___tmainCRTStartup 함수)에서 확인하지 못했습니다.
1>D:\cpp\ch9\Debug\ch9.exe : fatal error LNK1120: 1개의 확인할 수 없는 외부 참조입니다.
========== 빌드: 성공 0, 실패 1, 최신 0, 생략 0 ========== |
| c++ class / const member variable & function (0) | 2014.02.28 |
|---|---|
| deep copy / shallow copy < object copy (0) | 2014.02.27 |
| c++ constructor (0) | 2014.02.26 |
| C++11 Lambda Fuction (2) | 2013.11.20 |
| C++ AMP (Accelerated Massive Parallelism) (0) | 2013.10.08 |
#include < iostream >
using namespace std;
class test
{
int a1, a2;
int a;
public:
test()
{
}
test(int b)
{
cout << "constructor called" << endl;
a = b;
}
void dump()
{
cout << a1 << ' ' << a2 << ' ' << a << endl;
}
};
void main()
{
cout << "tt" << endl;
test tt;
cout << "t2(11)" << endl;
test t2(11);
cout << "tt = 11" << endl;
tt = 11;
cout << "tt = 55" << endl;
tt = 55;
tt.dump();
t2.dump();
}| tt
t2(11)
constructor called
tt = 11
constructor called
tt = 55
constructor called
-858993460 -858993460 55
-858993460 -858993460 11 |
1>error C2679: 이항 '=' : 오른쪽 피연산자로 'int' 형식을 사용하는 연산자가 없거나 허용되는 변환이 없습니다.
1> 'test &test::operator =(const test &)'일 수 있습니다.
1> 인수 목록 '(test, int)'을(를) 일치시키는 동안 |
| deep copy / shallow copy < object copy (0) | 2014.02.27 |
|---|---|
| crt0.o / crtexe.obj (0) | 2014.02.27 |
| C++11 Lambda Fuction (2) | 2013.11.20 |
| C++ AMP (Accelerated Massive Parallelism) (0) | 2013.10.08 |
| c++ class - friend (0) | 2013.03.15 |
| int main()
{
const int a = 0;
int *p;
p = &a;
printf("%d %d\n",a,*p);
*p = 2;
// a = 1;
printf("%d %d\n",a,*p);
return 0;
} |
| $ ./a.out
0 0
2 2
|
| 1> error C2440: '=' : 'const int *'에서 'int *'(으)로 변환할 수 없습니다. 1> 변환하면서 한정자가 손실됩니다. |
| const int const *p1; 1> warning C4114: 동일한 형식 한정자를 두 번 이상 사용했습니다. |
| 2중 포인터 사용이유 (0) | 2014.03.19 |
|---|---|
| typeof (0) | 2014.03.11 |
| assert() (0) | 2013.12.18 |
| printf의 %s와 %S (0) | 2013.06.15 |
| win32api - joystick 예제 (0) | 2013.06.15 |
| OpenNI - Open Natural Interaction (0) | 2014.06.30 |
|---|---|
| opencv2 웹캠 관련 문서 (0) | 2014.06.28 |
| Interoperability with OpenCV 1 (0) | 2014.02.08 |
| opencv2 on ubuntu (2) | 2013.11.10 |
| openCV Mat / iplImage (0) | 2012.02.21 |