Sponsored Content
Top Forums Programming Restricting member of a class non-inheritable in C++ Post 302866795 by DGPickett on Tuesday 22nd of October 2013 05:28:57 PM
Old 10-22-2013
I recall inheritance is for adding, not subtracting. If you have a first class with the common subset, you can inherit and add as you go. D1 can inherit from D2 and add.

If all access is by methods, the methods can be made to do various things if you want a member to not really exist.
 

10 More Discussions You Might Find Interesting

1. Solaris

restricting access

Hi All, I'm on Solaris 8, I need to provide Read-only access to a user to 2 directories only. Using rsh (restricted shell) as the user's login shell, I can restrict the user's access to a certain directory only, but how can I set in such a way that the user can access only the 2 directories... (4 Replies)
Discussion started by: max_min
4 Replies

2. Programming

Handling a signal with a class member function

Hello, i am using the sigaction function to handle the SIGCHLD signal.Is it possible to use a class member function as the handler function (the sa_handler member of the sigaction structure)? The function's signature is: void (*sa_handler)(int);so i don't think i can use a static member function... (2 Replies)
Discussion started by: Zipi
2 Replies

3. UNIX for Dummies Questions & Answers

car class (not school class)

im just trying to have some fun and kill some time writing a c++ program that has a person type in a car make and model then gives them a year and a price. or something like that. i always have problems getting it goin but once the ball is rolling im usually pretty good. anyone wanna help me out? ... (1 Reply)
Discussion started by: rickym2626
1 Replies

4. Programming

C++ class definition with a member of the same class

Hi, i have a question about C++. Is it possible to declare a class with a member ot the same class? For example, a linked list or i want to convert this C code to C++ class (Elemento) typedef struct elemento { char name; char value; List<struct elemento> ltElementos; ... (7 Replies)
Discussion started by: pogdorica
7 Replies

5. Shell Programming and Scripting

restricting users

how can i make my users to not use particular commands in the network like:wall....... pl z help me regarding this (1 Reply)
Discussion started by: yashwanthguru
1 Replies

6. Programming

Writing C++ class and member functions

I have the following class and thought that when I call the set command to set a member, I always use value. Would that be fine? class ModMisfit { protected: Real dtau; Real mdacc; Real mindist; bool hw; Source** src; public: void ... (7 Replies)
Discussion started by: kristinu
7 Replies

7. Programming

static use for class inside the same class c++

Hi, I believe the next code is wrong: class Egg { Egg e; int i; Egg(int ii=0) : i(ii) {} }; because you would end up with an endless definition (memory allocation) of Egg objects, thus int i. Ok, so God Eckel proposes for a singleton: class Egg { static Egg e; int... (5 Replies)
Discussion started by: xavipoes
5 Replies

8. UNIX for Advanced & Expert Users

Get pointer for existing device class (struct class) in Linux kernel module

Hi all! I am trying to register a device in an existing device class, but I am having trouble getting the pointer to an existing class. I can create a class in a module, get the pointer to it and then use it to register the device with: *cl = class_create(THIS_MODULE, className);... (0 Replies)
Discussion started by: hdaniel@ualg.pt
0 Replies

9. Programming

Size of Derived class, upon virtual base class inheritance

I have the two class definition as follows. class A { public: int a; }; class B : virtual public A{ }; The size of class A is shown as 4, and size of class B is shown as 16. Why is this effect ?. (2 Replies)
Discussion started by: techmonk
2 Replies

10. Programming

C++ : Base class member function not accessible from derived class

Hello All, I am a learner in C++. I was testing my inheritance knowledge with following piece of code. #include <iostream> using namespace std; class base { public : void display() { cout << "In base display()" << endl; } void display(int k) {... (2 Replies)
Discussion started by: anand.shah
2 Replies
class_part_initialize() 												   class_part_initialize()

Name
  class_part_initialize - Object class method to initialize class part structure fields.

Synopsis
  typedef void (*XtWidgetClassProc)(WidgetClass);
	 WidgetClass subclass;

Inputs
  subclass  Specifies the pointer to a widget class structure.	It is the class that registered this method or a subclass thereof.

Description
  The class_part_initialize() method is registered on the class_part_initialize field of the Object, RectObj, or Core class structure, and is
  called to dynamically initialize any fields in the class part structure of its widget class.

  During class initialization, the class_part_initialize() method for the class and for all its superclasses is called in  superclass-to-sub-
  class  order on the class record.  These procedures do any dynamic initializations necessary to their class's part of the record, including
  resolution of any inherited methods defined in the class.  For example, if a widget class C has superclasses Core,  Composite,  A,  and  B,
  then	the  class  record for C is passed first to Core's class_part_initialize() method.  This resolves any inherited Core methods and com-
  piles the textual representations of the resource list and action table that are defined in the Core class  part.   Next,  the  Composite's
  class_part_initialize()  is  called  to initialize the Composite part of C's class record.  Finally, the class_part_initialize() procedures
  for A, B, and C (in order) are called.  All these methods will be called again if subclass D of class C is initialized, this time  to  ini-
  tialize the various parts of D's class structure.

  The  class_part_initialize() method is chained in superclass-to-subclass order and cannot be inherited.  Classes that do not define any new
  class fields or that need no extra processing for them can set their class_part_initialize field to be NULL.

  See the "Background" section below for more details on when class initialization is performed.

Usage
  The subclass argument to a class_part_initialize() procedure may be the widget class itself, or any subclass of it.  You should cast it  to
  a  pointer to your widget class and use that pointer to access the fields of the class part structure that your class defines.  If you need
  to access the superclass, use the superclass field in the Object, RectObj, or Core class part.  This is shown in the example below.

  The most common usage of the class_part_initialize() method is to handle inheritance of class methods and other fields.  If  you  define  a
  class  with  a  method  or  other field that can be inherited, you should define a special value that the writer of the subclass can use to
  inherit the field (use the constant _XtInherit cast to the appropriate type, as shown in the example below) and provide  a  class_part_ini-
  tialize() method which checks the inheritable field for this special value and overwrites it with the contents of the superclass's field.

Example
  The  following  procedure is the class_part_initialize() method for the Xaw Form widget class.  Note how it determines the immediate super-
  class and handles the inheritance of the Form layout() class method.

  Note that it does not initialize the Core, Composite, or Constraint class part fields, nor does it make any assumptions about  its  Widget-
  Class argument except that it is a subclass of Form.	Also note that when this method is called for the Form widget class itself, the vari-
  able super will be set to the superclass of Form, which cannot correctly be cast to FormWidgetClass.	This is a bug, but will  never	cause
  problems, because the Form class itself will never have to inherit any fields.

  Note	that the identifier class is a reserved word in C++, and your code will be more portable if you avoid using it as an argument name in
  C code.

     static void ClassPartInitialize(class)
	 WidgetClass class;
     {
	 register FormWidgetClass c = (FormWidgetClass)class;
	 register FormWidgetClass super = (FormWidgetClass)
	     c->core_class.superclass;

	 if (c->form_class.layout == XtInheritLayout)
	     c->form_class.layout = super->form_class.layout;
     }

  The constant XtInheritLayout is defined as follows (in <X11/Xaw/FormP.h>):

     #define XtInheritLayout ((Boolean (*)())_XtInherit)

Background
  All widget classes, whether or not they have class and class part initialization procedures,	must  start  with  their  class_inited	field
  False.

  The  first  time  a  widget  of a class is created, XtCreateWidget() ensures that the widget class and all superclasses are initialized, in
  superclass-to-subclass order, by checking each class_inited field.  If this field is False, XtCreateWidget() calls  the  class_initialize()
  and  the  class_part_initialize()  methods  for  the	class  and all its superclasses.  The Intrinsics then set the class_inited field to a
  nonzero value.  After the one-time initialization, a class structure is constant.  This initialization can also  be  performed  explicitly,
  without creating a widget, by calling XtInitializeWidgetClass().

See Also
  XtInitializeWidgetClass(1),
  Core(3),
  class_initialize(4), initialize(4).

Xt - Intrinsics Methods 												   class_part_initialize()
All times are GMT -4. The time now is 05:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy