OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.cp/] [pr9594.cc] - Blame information for rev 231

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
 
2
class Base
3
{
4
public:
5
  virtual int get_foo () { return 1; }
6
  int base_function_only () { return 2; }
7
};
8
 
9
class Foo : public Base
10
{
11
 
12
private:
13
  int foo_value;
14
 
15
public:
16
  Foo () { foo_value = 0;}
17
  Foo (int i) { foo_value = i;}
18
  ~Foo () { }
19
  void set_foo (int value);
20
  int get_foo ();
21
 
22
  // Something similar to a constructor name.
23
  void Foofoo ();
24
 
25
  bool operator== (const Foo &other) { return foo_value == other.foo_value; }
26
};
27
 
28
void Foo::set_foo (int value)
29
{
30
  foo_value = value;
31
}
32
 
33
int Foo::get_foo ()
34
{
35
  return foo_value;
36
}
37
 
38
void Foo::Foofoo ()
39
{
40
}
41
 
42
int main ()
43
{
44
  // Anonymous struct with method.
45
  struct {
46
    int get() { return 5; }
47
  } a;
48
  Foo foo1;
49
  foo1.set_foo (42);            // Set breakpoint here.
50
  a.get();                      // Prevent compiler from throwing 'a' away.
51
  return 0;
52
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.