File: cpptest.cpp

package info (click to toggle)
eclipse-linuxtools 1.0.0-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 69,212 kB
  • sloc: java: 224,575; xml: 23,980; ansic: 15,426; python: 458; cpp: 279; sh: 251; makefile: 48
file content (54 lines) | stat: -rw-r--r-- 986 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*******************************************************************************
 * Copyright (c) 2009 Red Hat, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Elliott Baron <ebaron@redhat.com> - initial API and implementation
 *******************************************************************************/
#include "cpptest.h"

int x = 3;

class A {
public:
	A() : y(6) {}
	int c() {
		B b = B();
		b.d();
		return b.x + y;
	}
private:
	class B {
	public:
		B() : x(5) {}
		void d() {
			x++;
			e();
		}
		int x;
	private:
		void e() {
			x--;
		}
	};
	int y;
};

int Foo::bar(int z) {
	return x + baz(y, z);
}

int Foo::baz(int a, int b) {
	return a + b;
}

int main(int argc, char **argv) {
	Foo f = Foo();
	A a = A();
	f.bar(5);
	a.c();
	return 0;
}